It is currently March 29th, 2024, 1:26 am

RegExpSubstitute Help

Get help with creating, editing & fixing problems with skins
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

RegExpSubstitute Help

Post by xenium »

Hi,

For other languages ​​(except English) the text for detailed alerts looks like this:


Avis pour petites embarcations jusqu'à MER. 20:00 -04:00
OR
Perturbations possibles dues aux orages de JEU. 09:00 +03:00 à SAM. 09:00 +03:00


How to use RegExpSubstitute to stop displaying -04:00 or +03:00 ?

Thank You
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: RegExpSubstitute Help

Post by balala »

xenium wrote: June 17th, 2020, 6:01 pm How to use RegExpSubstitute to stop displaying -04:00 or +03:00 ?
Try to add to the appropriate measure the following two options:

Code: Select all

RegExpSubstitute=1
Substitute="(\+|-)(\d{2}:\d{2})":""
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: RegExpSubstitute Help

Post by jsmorley »

Code: Select all

[MeasureString]
Measure=String
String=Perturbations possibles dues aux orages de JEU. 09:00 +03:00 à SAM. 09:00 +03:00
RegExpSubstitute=1
Substitute="(?siU)[\+|\-]\d\d:\d\d":""
Perturbations possibles dues aux orages de JEU. 09:00 à SAM. 09:00
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: RegExpSubstitute Help

Post by balala »

jsmorley wrote: June 17th, 2020, 6:15 pm

Code: Select all

[MeasureString]
Measure=String
String=Perturbations possibles dues aux orages de JEU. 09:00 +03:00 à SAM. 09:00 +03:00
RegExpSubstitute=1
Substitute="(?siU)[\+|\-]\d\d:\d\d":""
Do you have to escape the - character as well? Because as far as I can tell, it is not a reserved character, so the backslash is not needed.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: RegExpSubstitute Help

Post by jsmorley »

balala wrote: June 17th, 2020, 6:19 pm Do you have to escape the - character as well? Because as far as I can tell, it is not a reserved character, so the backslash is not needed.
Probably not, I just didn't feel like double checking that, and it does no harm. In Lua "pattern matching" the - is in fact reserved. So better safe than sorry.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: RegExpSubstitute Help

Post by balala »

jsmorley wrote: June 17th, 2020, 6:25 pm Probably not, I just didn't feel like double checking that, and it does no harm. In Lua "pattern matching" the - is in fact reserved. So better safe than sorry.
Alright, understand. :thumbup:
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: RegExpSubstitute Help

Post by xenium »

balala wrote: June 17th, 2020, 6:14 pm

Code: Select all

RegExpSubstitute=1
Substitute="(\+|-)(\d{2}:\d{2})":""
jsmorley wrote: June 17th, 2020, 6:15 pm

Code: Select all

RegExpSubstitute=1
Substitute="(?siU)[\+|\-]\d\d:\d\d":""
Both solutions work.
Thank you very very much :bow: :bow:
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: RegExpSubstitute Help

Post by jsmorley »

You are welcome...
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: RegExpSubstitute Help

Post by balala »

:thumbup: :great: