I am pretty new to regular expressions. I need to clean up a search string from spaces at the beginning and the end. Example: \" search string \" Result: \"search string\"
If it's only white-space, why not just use trim()?
Yep, you should use trim() I guess.. But if you really want that regex, here it is:
((?=^)(\s*))|((\s*)(?>$))