Skip to content
jehna edited this page Jul 20, 2013 · 2 revisions

Description: Mark the expression to end at the last character of the line.

Example: The following adds string "Stop." to the end of each line

var lorem = "Lorem ipsum.\nDolor sit amet."
lorem = VerEx().endOfLine().replace( lorem, " Stop." );

/* Outputs:
Lorem ipsum. Stop.
Dolor sit amet. Stop.
*/

See similar examples at the [.startOfLine() method documentation page](https://github.com/jehna/VerbalExpressions/wiki/.startOfLine(\)).

.endOfLine( enable )

Description: Enable or disable the expression to end at the last character of the line.

Parameter Description
Boolean enable (optional) Enables or disables the line ending. Default value: true

Example: The following example first creates an expression to firest replcae all strings that begin with specifiesd string. Afterwards, the expression is reused to apply strings anywhere in the string.

var lorem = "Lorem ipsum\nLorem ipsum and something else";

var expression = VerEx().endOfLine().then( "Lorem ipsum" );
lorem = lorem.replace( expression , "First replacement" );

expression.endOfLine( false );
lorem = lorem.replace( expression , "Second replacement" );

/* Outputs:
First replacement
Then comes second replacement
*/
Clone this wiki locally