It is currently May 4th, 2024, 12:40 am

How can I substitute something like this fx([0-9]{3})

Get help with creating, editing & fixing problems with skins
Xeramon
Posts: 9
Joined: August 18th, 2012, 12:12 pm

How can I substitute something like this fx([0-9]{3})

Post by Xeramon »

Hey,

I got a little issue (again), my substitute looks like this:

Substitute="fx1":"","fx2":"","fx3":"",[..]"fx23":"","fx24":"","fx25":"",[..]"fx154":"","fx155":"","fx156":""

but is it possible to make somethink like this(?):

Substitute="fx([0-9]{3})":""

I am sorry for my broken english
~Xeramon
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: How can I substitute something like this fx([0-9]{3})

Post by MerlinTheRed »

Yes you can. See the manual: http://rainmeter.net/cms/Measures-Substitute_beta

You must add RegExpSubstitute=1 to the measure.
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: How can I substitute something like this fx([0-9]{3})

Post by jsmorley »

RegExpSubstitute=1
Substitute="fx([0-9][0-9][0-9]|[0-9][0-9]|[0-9])":""
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: How can I substitute something like this fx([0-9]{3})

Post by MerlinTheRed »

Why not "fx[0-9]{1,3}":"" ?
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: How can I substitute something like this fx([0-9]{3})

Post by jsmorley »

MerlinTheRed wrote:Why not "fx[0-9]{1,3}":"" ?
Oh, derp... I had "or" on my mind mind from something else that involved text instead of numbers. Yeah, that will work as well, as is a bit shorter.
Xeramon
Posts: 9
Joined: August 18th, 2012, 12:12 pm

Re: How can I substitute something like this fx([0-9]{3})

Post by Xeramon »

I am not sure why, but
RegExpSubstitute=1
Substitute="fx[0-9]{1,3}":"",


Is crashing my rainmeter.

RegExpSubstitute=1
Substitute="fx([0-9][0-9][0-9]|[0-9][0-9]|[0-9])":""


also.

Edit
This is what im trying to use:
Substitute="fx([0-9][0-9][0-9]|[0-9][0-9]|[0-9])":"","=</span>":"","-":"",'"':'',"<center>":"#CRLF#","|":"","/":"","</center>":"","<span class=":"",">":"","</span>":"","</span class":"","span":"","class":"","<":"",">":""

(I know its a bit disorganized)


Edit: Nevermind, I revrote my Substitute and it works now. Thank you very much!

Substitute="fx[0-9]{1,3}":"","<center>":"#CRLF#","</center>":"","</span>":"","<span class=":"","<":"",">":"",'"':'',"-=":""
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: How can I substitute something like this fx([0-9]{3})

Post by MerlinTheRed »

You have to take care to escape special characters in regexps. For example, "|" is an "or", so "|":"," might have caused a problem. If you want to match a literal "|" you have to use "\|".
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!