It is currently April 27th, 2024, 4:39 pm

[Solved] InlinePattern - How to match multiple occurences, and more than one strings?

Get help with creating, editing & fixing problems with skins
User avatar
lysy1993lbn
Posts: 291
Joined: July 25th, 2011, 9:53 am
Location: Lublin, Poland

[Solved] InlinePattern - How to match multiple occurences, and more than one strings?

Post by lysy1993lbn »

Hi

I'm having trouble figuring out how my inline pattern should look like to match all occurences of "GB" and "%" from a string of
Memory: some GB (some %) of some GB

Best I could get to work so far was just using multiple InlinePatterns, but for "code cleanliness" sake, but I'd like to learn how to do it in single InlinePattern as I'm trying to get identical InlineOption for both
Last edited by lysy1993lbn on November 18th, 2023, 9:33 pm, edited 1 time in total.
"Never argue with an idiot, he will drag you down to his level and beat you with experience."
my deviantART | Alternative Rainmeter tray icons
User avatar
Yincognito
Rainmeter Sage
Posts: 7177
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: InlinePattern - How to match multiple occurences, and more than one strings?

Post by Yincognito »

lysy1993lbn wrote: November 18th, 2023, 7:54 pm Hi

I'm having trouble figuring out how my inline pattern should look like to match all occurences of "GB" and "%" from a string of
Memory: some GB (some %) of some GB

Best I could get to work so far was just using multiple InlinePatterns, but for "code cleanliness" sake, but I'd like to learn how to do it in single InlinePattern as I'm trying to get identical InlineOption for both
You can try (GB|%) in your InlinePattern option. It might work without capturing the group too, via (?:GB|%) in that option. The ( and ) stand for capturing the group, (?: and ) enclose a non capturing group, and | stands for a logical OR in the regular expressions.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
lysy1993lbn
Posts: 291
Joined: July 25th, 2011, 9:53 am
Location: Lublin, Poland

Re: InlinePattern - How to match multiple occurences, and more than one strings?

Post by lysy1993lbn »

Yincognito wrote: November 18th, 2023, 9:27 pm (?:GB|%)
That did the trick. Thanks for rapid response :thumbup:
"Never argue with an idiot, he will drag you down to his level and beat you with experience."
my deviantART | Alternative Rainmeter tray icons
User avatar
Yincognito
Rainmeter Sage
Posts: 7177
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: InlinePattern - How to match multiple occurences, and more than one strings?

Post by Yincognito »

lysy1993lbn wrote: November 18th, 2023, 9:32 pm That did the trick. Thanks for rapid response :thumbup:
You're welcome - glad to help. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth