/t5/coldfusion-discussions/strip-characters-from-string/td-p/850413Oct 15, 2008
Oct 15, 2008
Copy link to clipboard
Copied
Hi,
How can I strip off some characters from the end of a string?
I am not very good at regular expressions but perhaps I may not
need one? Here is the data
first_name_510
last_name_2267
I need a function that will strip off everything from the
right including the underscore. I should be left with the below:
just for reference, if you want to see what a simple regular
expression version might look like:
#REReplace(yourstring, "(.+_.+)_.+", "\1")#
but I think the best way is to treat it like a list with an
underscore delimiter, like Fernis.