Xfce Forum

Sub domains
 

You are not logged in.

#1 2023-12-07 04:52:01

uibits
Member
Registered: 2022-07-02
Posts: 39

[SOLVED] Regex broken, anything in Mousepad to help?

I'm editing a pretty big regex pattern in Mousepad and broke something.

Is there a way Mousepag can highlight in some way where a regex pattern has gone wrong? All I get from the progam is "you have mismatched parentheses '(' and ')'". Maybe something that adds color. etc?

Any plugins for it etc?

EDIT: I have tried code colouring for every kind of filetype ("Script" and "Other") that Mousepad has but to no avail. i do know that regex's can differ slightly depending on the context, so I'm not going to ever imply that it would be easy to have something for every occasion, but it might be nice to have a couple most common regex's covered in Mousepad?

EDIT EDIT: (Woops, this should be in General Discussion not Desktop.) Also tried undoing everything since it last worked in case I middle mouse clicked in the wrong spot or something, Nope, not that. I'm in the process now of indenting with newlines for all parentheses and OR '|' symbols. It is tedious. neutral  Does anyone have experience with handling regex's in Mousepda?

Last edited by uibits (2023-12-08 02:41:45)

Offline

#2 2023-12-07 06:37:14

JayGursky
Member
Registered: 2023-07-04
Posts: 21

Re: [SOLVED] Regex broken, anything in Mousepad to help?

There are online tools to check regex'es, experiment and learn. One is
https://regex101.com

Offline

#3 2023-12-07 10:44:20

Tamaranch
Member
Registered: 2020-12-31
Posts: 321

Re: [SOLVED] Regex broken, anything in Mousepad to help?

There is some highlighting of regexes using Perl as a language, but I don't think there is a dedicated regex language. Mousepad relies on GtkSourceView for this anyway: https://gitlab.gnome.org/GNOME/gtksourceview

Offline

#4 2023-12-08 02:40:59

uibits
Member
Registered: 2022-07-02
Posts: 39

Re: [SOLVED] Regex broken, anything in Mousepad to help?

Thanks for the ideas!

JayGursky, unforunately that regex101 site didn't load properly, seemed to require special wasm javascript, which I don't allow.

Good to know where Mousepad gets the functionality from, Tamaranch.

What I ended up doing was testing large chunks of the regex separately. In almost a binary search-like fashion, I tested smaller and smaller parts of the regex till I could read the chunck slowly, and quickly determined where the missing parenthesis was. Can't believe I didn't think to do this earlier, but I guess now future readers have three methods to consider.

smile

Thanks again!

Offline

#5 2023-12-08 05:52:25

JayGursky
Member
Registered: 2023-07-04
Posts: 21

Re: [SOLVED] Regex broken, anything in Mousepad to help?

> unforunately that regex101 site didn't load properly, seemed to require special wasm javascript, which I don't allow.

Searching "regex test" and "open source regex testing utility" gives dozens of online and offline tools to play with regexes. Some of them might work for you.

Mousepad is a simple editor and it's natural if it's not supposed to have extensive regex explanations, especially when all those other tools are available.

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.011 seconds, 7 queries executed - Memory usage: 533.62 KiB (Peak: 534.46 KiB) ]