Template:Nowordbreak
Appearance
| Template documentation |
|---|
| Note: portions of the template sample may not be visible without values provided. |
| View or edit this template's documentation (edit) (about template documentation). |
No TemplateStyles exist (create). Remember to add after the opening <includeonly> tag:
|
<templatestyles src="Template:Nowordbreak/styles.css" />
|
This template will return the first n characters of a string, without breaking words. Numbers however, will be broken apart.
Note: This template requires the RegexFunctions extension and the Variables extension (whose future is uncertain).
Usage examples
[edit source]| Code | Gives |
|---|---|
{{nowordbreak|Testing, testing, 123|11}}
|
/[\W0-9]$/|Testing, te|{{#rmatch:Testing, tes|/[\W0-9]$/|Testing, te|{{#rmatch:Testing, te|/^(.*[\s]).*$/|$1|Testing, te}}}}}} |
{{nowordbreak|Testing, testing, 123|20}}
|
/[\W0-9]$/|Testing, testing, 12|{{#rmatch:Testing, testing, 123|/[\W0-9]$/|Testing, testing, 12|{{#rmatch:Testing, testing, 12|/^(.*[\s]).*$/|$1|Testing, testing, 12}}}}}} |