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 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
It is currently April 18th, 2024, 12:04 pm
RegExpSubstitute
-
- Rainmeter Sage
- Posts: 7120
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: RegExpSubstitute
-
- Posts: 26
- Joined: March 11th, 2019, 5:42 pm
Re: RegExpSubstitute
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
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
-
- Rainmeter Sage
- Posts: 7120
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: RegExpSubstitute
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).