It is currently September 20th, 2019, 8:29 am

How to delete all white spaces ?

Help with creating, editing & fixing problems with skins
trinhanhngoc
Posts: 23
Joined: May 23rd, 2010, 3:48 pm

How to delete all white spaces ?

trinhanhngoc » June 9th, 2010, 7:48 am

I use WebParser to get one data on internet. Example:
...
RegExp="(?siU)...(.*)..."
...
(.*) -> " #very much white spaces# Stairway to Heaven"
How to delete all white spaces before the value ?
Become :
(.*) -> "Stairway to Heaven".
User avatar
Alex2539
Rainmeter Sage
Posts: 648
Joined: July 19th, 2009, 5:59 am
Location: Montreal, QC, Canada

Re: How to delete all white spaces ?

Alex2539 » June 9th, 2010, 8:16 am

Try using \s*(\S.*) instead of (.*). The "\s" is shorthand for any whitespace, whereas "\S" is shorthand for anything that's NOT whitespace. Basically, this says to go through whitespace characters, until it hits a non-whitespace character, at which point it saves the rest. If you had a file like this:

Code: Select all

<tag1>                       SOME STUFF</tag1>
And then used this RegExp:

Code: Select all

RegExp="(?siU)<tag1>\s*(\S.*)</tag1>"
The result would be "SOME STUFF".
ImageImageImageImage
trinhanhngoc
Posts: 23
Joined: May 23rd, 2010, 3:48 pm

Re: How to delete all white spaces ?

trinhanhngoc » June 9th, 2010, 8:41 am

Thanks you. More...
\s*(\S.*) Before String
(\S.*)\s* After String
\s*(\S.*)\s* Before & After String.