It is currently April 18th, 2024, 12:04 pm

RegExpSubstitute

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 7120
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: RegExpSubstitute

Post by Yincognito »

roguetrip wrote: April 13th, 2019, 10:48 pm Your regex works well unless its something like N270 but changing it to ^.*[- ]([A-Z]*\d{3,}[A-Z]*) .*$ fixes that.


adding the \D* adds back more than wanted for some reason. Weird since I had it working well enough by changing my regex to "^.*?-?(\D?\d{3,}\D?\D?) .*?$":"\1"," ":"" before your post earlier



Example with regex: ^.*[- ](\D*\d{3,}\D*) .*$ returns 8320 Eight-Core with string AMD FX(tm)-8320 Eight-Core Processor
Well, \D means anything that is not \d (digit), so it probably matches spaces and puctuation as well. In practice, this means it will match until the last space found, which is before Processor.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
roguetrip
Posts: 26
Joined: March 11th, 2019, 5:42 pm

Re: RegExpSubstitute

Post by roguetrip »

sure, I'll go with that ;)

My thought of \D = [a-z][A-Z].

Noob issues lol

Anyways. Thanks for all the help. It helped me fix my other regex subs to not depend on the ? Quantifiers
User avatar
Yincognito
Rainmeter Sage
Posts: 7120
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: RegExpSubstitute

Post by Yincognito »

roguetrip wrote: April 14th, 2019, 1:13 am sure, I'll go with that ;)

My thought of \D = [a-z][A-Z].

Noob issues lol

Anyways. Thanks for all the help. It helped me fix my other regex subs to not depend on the ? Quantifiers
You're welcome. Regexes can depend on the ? Quantifiers, just not abuse the latter (because you may find yourself without any actual anchor in those regexes, if everything is optional).
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth