[Regex Bug] Regex pattern is not working correctly

Hi, i’m having an issue making this regex pattern work: “Tarjeta (105 x 148 mm)”
The string on the Window Title is: “Cumple Benja - Tarjeta (105 x 148 mm) — Mozilla Firefox”

I’ve tweaked the search pattern a bit, tried without backlashes, tried with just the first section and avoiding the second “)” (in case the issue had to do with something like the issue i mention below), also tried to search “105 x 148 mm” but none of that works. “Cumple Benja” does.
I’m guessing the issue could be related with the spaces and special characters like parentheses and dashes, it’s possible that the regex engine is not interpreting the spaces or symbols correctly or something to do with the search being abruptly stopped by some other error? Tried to debug it but don’t have much time to go deep into it and search for the problem

I’ve seen this post, which looks similar to the issue but apparently the issue is not related to this exactly.

Thanks for this cool tool :slight_smile: i’d love to be a code supporter

*** Update: I’ve found the issue starts AFTER the “105”, regex “- Tarjeta (105” would work. Issue could very much be the whitespace, maybe it’s some kind of special whitespace character and not a regular one.
Easy fix could be to match every type of whitespace like a regular whitespace by default

*** Update 2: Confirmed, that’s the issue.
In “aw-watcher-window/aw_watcher_window/main.py” by replacing line 148:

if pattern.search(current_window["title"]):

with

if pattern.search(re.sub(r'\s', ' ', current_window["title"])):

the problem should go (haven’t tested the code), of course this would mean we are assuming everyone would want this approach as to how the regex manages whitespaces and i understand that might not be the desired objective, but maybe a checkbox could be added to the frontend to default this behaviour in case anyone needs it

I hope my little research is somewhat useful to the team haha, cheers

Were you able to get the regex working by putting \s instead of normal spaces?

Yup, That’s right

(Gotta write more for 20 chars haha)