Regex to match last space character
Posted
by Gerald Ferreira
on Stack Overflow
See other posts from Stack Overflow
or by Gerald Ferreira
Published on 2010-03-17T16:29:19Z
Indexed on
2010/03/17
16:31 UTC
Read the original article
Hit count: 445
regex
Hi There I need some help
I am looking for a regex that would match the last space character in a string.
I am using Javascript and Classic ASP
If there is someone that could maybe point me in the right direction
I have a long string of text which I trim to 100 characters.
I would like to remove the last character to avoid a spelling mistake if the trim cuts a word due to the 100 characters limit
regex.replace(/[ ]$.*?/ig, '');
Anybody with ideas?
Thanks
© Stack Overflow or respective owner