I’ve got a textfield with a bunch of punctuation which is always surrounded by spaces. So that for instance:
I don't recall saying ' pick up the boot ' or ' now is the time ' . But it's possible , so I may have .
What is the regular expression syntax to get rid of these spaces? I’m working in actionscript.
Edit: it’s actually both leading and trailing, as you can see from the above example.
Try this:
For this particular string you’ll get that result:
May be the first regexp need some adjustments as it won’t work for string like
as it’ll be converted to
Short explanation for special symbols used in first regexp:
\sis for space character (space, tab).means any character*zero or more repetition?makes*quantifier non-greedy, so it’ll match as less characters as possible$1You can find more information about regexps on this site or in this section of docs from Adobe.