It is currently April 25th, 2024, 6:36 am
Report bugs with the Rainmeter application and suggest features.
redsaph
Posts: 30 Joined: October 24th, 2013, 8:15 am
Post
by redsaph » October 10th, 2017, 12:46 pm
Hello,
I use the following RegEx statement to trim down the title of a song and use the first capture group
in order to do it:
Code: Select all
^(.+) (-.+|((\(|\[)?\s?(remix|Remix|REMIX|with|With|WITH|feat|Feat|FEAT|ft|Ft|FT|(w|W)\/).+))+$
Now, I took Kendrick Lamar's song Loyalty which is titled as
This should return
Why this isn't working for
RegExpSubtitute and
Subtitute when various online testers and RainRegExp verify it works?
Last edited by redsaph on October 13th, 2017, 10:14 am, edited 3 times in total.
balala
Rainmeter Sage
Posts: 16168 Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania
Post
by balala » October 10th, 2017, 1:28 pm
I think something is not ok with the posted regular expression: it has mor opened parenthesis then closed ones.
But first, please post the whole code. It'd be much simpler to help.
ikarus1969
Posts: 571 Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria
Post
by ikarus1969 » October 10th, 2017, 2:32 pm
balala wrote: I think something is not ok with the posted regular expression: it has mor opened parenthesis then closed ones.
That's because one of the open parenthesis is escaped with the backslash character.
@redsaph:
what i would try is to replace the regular expression by:
Code: Select all
(?siU)^(.+) (-.+|((\(|\[)?\s?(remix|with|feat|ft|w\/).+))+$
which would simplify it a little bit.
the
i in
(?siU) means "ignore case" so you don't have to code all the possible different cases like "remix" "REMIX", etc.
it work's in RainRegExp too.
But i agree with balala; it would be much easier to help with the code of the whole skin. Or at least a test skin we can have a look at.
redsaph
Posts: 30 Joined: October 24th, 2013, 8:15 am
Post
by redsaph » October 10th, 2017, 2:39 pm
Hi guys, thanks for the quick response. Here's the simple example, maybe you could see it too:
Code: Select all
[Rainmeter]
Update=50
Author=Redsaph
AccurateText=1
[mTitle1]
Measure=Plugin
Plugin=SpotifyPlugin.dll
Type=TrackName
RegExpSubstitute=1
Substitute="^(.+) (-.+|((\(|\[)?\s?(remix|Remix|REMIX|with|With|WITH|feat|Feat|FEAT|ft|Ft|FT|(w|W)\/).+))+$":"\1"
; =================================================
; Meters
[Background]
Meter=Image
X=0
Y=0
W=700
H=100
SolidColor=0,0,0,180
UpdateDivider=-1
[Title]
Meter=String
Y=0
X=0
DynamicVariables=1
Text=[mTitle1]
FontFace=Segoe UI
FontSize=36
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Left
@ikarus1969 Thank you very much for simplifying my RegEx
I didn't know that existed!
ikarus1969
Posts: 571 Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria
Post
by ikarus1969 » October 10th, 2017, 2:57 pm
I admit i have no idea why your regexp doesn't work
Maybe someone else can help?!
balala
Rainmeter Sage
Posts: 16168 Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania
Post
by balala » October 10th, 2017, 6:15 pm
I agree with ikarus1969 and also don't know what's happening, why that Substitute option doesn't work. A
regular expression tester indeed returned the appropriate string, so, I have no idea what's happening...
But I'd suggest another substitution:
Substitute="(?siU)^(.*)\s*(remix|with|feat|ft)\.\s*(.*)$":"\1" . As ikarus1969 said, there's no need to list all those words, written uppercase and lowercase and so on. The
(?siU) can help in these cases.
redsaph
Posts: 30 Joined: October 24th, 2013, 8:15 am
Post
by redsaph » October 11th, 2017, 4:14 am
Thanks Ikarus and Balala! I hope someone from the development team can shed some light on this issue.
Brian
Developer
Posts: 2681 Joined: November 24th, 2011, 1:42 am
Location: Utah
Post
by Brian » October 11th, 2017, 4:44 am
The problem stems from a fix we did back in the
r2414 or
r2416 builds. We are evaluating a fix and will get back to you. Rainmeter versions prior to r2414 worked okay (for this particular issue).
-Brian
Brian
Developer
Posts: 2681 Joined: November 24th, 2011, 1:42 am
Location: Utah
Post
by Brian » October 12th, 2017, 4:00 pm
r2944 should have fixed this issue.
-Brian
ikarus1969
Posts: 571 Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria
Post
by ikarus1969 » October 13th, 2017, 9:24 am
Brian wrote: r2944 should have fixed this issue.
-Brian
this issue is fixed, thank you!
i used the following to test (shortened regex):
Code: Select all
[Rainmeter]
Update=1000
Author=Redsaph
AccurateText=1
; [mTitle1]
; Measure=Plugin
; Plugin=SpotifyPlugin.dll
; Type=TrackName
; RegExpSubstitute=1
; Substitute="^(.+) (-.+|((\(|\[)?\s?(remix|Remix|REMIX|with|With|WITH|feat|Feat|FEAT|ft|Ft|FT|(w|W)\/).+))+$":"\1"
[mTitle1]
Measure=STRING
String=LOYALTY. FEAT. RIHANNA.
RegExpSubstitute=1
; Substitute="^(.+) (-.+|((\(|\[)?\s?(remix|Remix|REMIX|with|With|WITH|feat|Feat|FEAT|ft|Ft|FT|(w|W)\/).+))+$":"\1"
Substitute="(?siU)^(.+) (-.+|((\(|\[)?\s?(remix|with|feat|ft|w\/).+))+$":"\1"
; =================================================
; Meters
[Background]
Meter=Image
X=0
Y=0
W=700
H=100
SolidColor=0,0,0,180
UpdateDivider=-1
[Title]
Meter=String
Y=0
X=0
DynamicVariables=1
measurename=mTitle1
; Text=[mTitle1]
FontFace=Segoe UI
FontSize=36
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Left