It is currently November 22nd, 2019, 1:55 pm

RegExpSubstitute

Help with creating, editing & fixing problems with skins
Yincognito
Posts: 682
Joined: February 27th, 2015, 2:38 pm

Re: RegExpSubstitute

Yincognito » April 13th, 2019, 11:00 pm

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.
roguetrip
Posts: 22
Joined: March 11th, 2019, 5:42 pm

Re: RegExpSubstitute

roguetrip » 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
Yincognito
Posts: 682
Joined: February 27th, 2015, 2:38 pm

Re: RegExpSubstitute

Yincognito » April 14th, 2019, 1:20 am

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).