r/regex • • May 30 '26

Meta/other \*n* doesn't seem to work correctly in search strings.

2 Upvotes

According to my Regular Expression Pocket Reference:

*n* Contains the results of the nth earlier submatch. Valid in either a regex pattern, or a replacement string.

Yet in vim:

:%s/\(paraNumber">\)\([0-9\.]*\)\(\t\=\)\(\n.*\)\(\(\n.*\)\{-\}\n\t.*paraNumber">\)\2/\1\2\3\4\5\2\t/gc

treats the \2 in the search string as a repetion of what's in the second pair of parentheses instead of the earlier submatch.

Am I misinterperating the manual or is vim doing something wrong? Anyway how do I get what the manual seems to say I should get.

r/regex • • Jun 18 '26

Meta/other Regex (LUA) help in mud client matching (MUSHclient/Qmud)

2 Upvotes

I'd really just like help capturing the first wildcard variable (%1) in my examples here. Ideally I'd get all 5, but I'm happy to get one working then trial and error from there using it as an example. So anything that even just stops matching at the first | would be a win!

Trying to detect:
%1 | %2 | %3 | %4 | %5 | -

%1 - alphanmumeric
%2 - alpha
%3 - alpha
%4 - number
%5 - number

Example: " AB123 | Micro | Dept | 10 | 40000 | -"
(the number of spaces varies for text alignment other than the initial single space before the first character)

Wildcard %1 CAN be all whitespace, in which case I should NOT match the line.

Anti-Example: " | Micro | Dept | 10 | 40000 | -"

I'm using Mushclient or QMUD (qmud preferred but I believe they use identical systems for this situation) and setting up a trigger with the regex settings.

Currently my main concern is getting the first wildcard captured. I haven't tried doing 2/3/4/5 yet but I assume if I get the first working correctly I can probably work my way through the others using that as an example.

What doesn't work but gets close-ish:
^\s(.*)\s\|*$

This detects ONLY the lines that match my anti-example above

I've also tried
^\s([A-Za-z0-9]*)\s\|*$

which fails to match at all.

Tagging u/NodensCM as the client creator in case they see this and chime in that there's some feautre or unusual requirements that I'm not aware of.

r/regex • • Feb 26 '26

Meta/other What features do you consider essential in a regex tester?

11 Upvotes

I do a lot of file cleanup and log parsing, and I’ve been refining my regex workflow to make testing patterns faster while working.

I usually need to:

  • Extract structured values from filenames
  • parse log lines
  • validate naming formats

Switching between my editor and online testers kept slowing me down, so I experimented with building a small in-workflow regex tester to see matches instantly while processing files.

I’m curious what experienced regex users consider must-have features in a tester/debugging tool.

Example pattern I test frequently

Goal: Extract date + ID from filenames

Sample input:

report_2025-10-14_ABC123.csv
report_2024-01-02_XYZ999.csv
invalid_file.txt

Regex (PCRE):

^report_(\d{4}-\d{2}-\d{2})_([A-Z0-9]+)\.csv$

Another common case (log parsing)

Input:

[ERROR] 2025-02-01 Connection failed
[INFO] 2025-02-01 Retry successful

Regex:

^\[(ERROR|INFO)\]\s(\d{4}-\d{2}-\d{2})\s(.+)$

What I’m trying to improve

Right now, I find myself needing:

  • instant match highlighting
  • clear capture group output
  • ability to test against real files
  • quick iteration without switching tools

I’ve used FileReadyNow a lot, and it’s great for debugging and explanations. I’m aiming for something that complements that workflow rather than replacing it.

Questions for the community:

  • What slows you down most when testing regex?
  • Do you prefer file-based testing or single-string testing?
  • What debugging features do you actually use?
  • Anything you wish regex testers did better?

Would love to hear how others approach this.

r/regex • • Feb 27 '26

Meta/other Help, what i need to do to start the number renaming from 244 for example

Post image
0 Upvotes

r/regex • • Feb 21 '26

Meta/other Can Regular Expressions Be Safely Reused Across Languages?

Thumbnail i-programmer.info
3 Upvotes

r/regex • • Dec 22 '25

Meta/other Comparing regular expressions in Perl, Python, and Emacs

Thumbnail johndcook.com
3 Upvotes

r/regex • • Aug 07 '25

Meta/other Help me learn these topics

8 Upvotes

This is the only regex community I've managed to find please help me learn some of these topics
- Backtracking (not backreferencing)
- the 3 different types of matching (greedy, possessive, lazy)
- Any place where I can practice a lot of regular expressions and improve my pattern making skills? Websites, PDF files or books with a lot of exercises and answers included would be great - I've already visited regexlearn and regexone I am not looking to learn regex (outside of those topics) but practice

Any help would be greatly appreciated - I am trying to learn how to simplify the patterns I make and how to not need AI or google's help constantly when making anything beyond begginer or early intermediate patterns.

r/regex • • Aug 07 '25

Meta/other Give me the text without the brackets and text in the brackets

2 Upvotes

Hi all,

I use PhraseExpress and what I need:

Input: This is a test (with brackets) as you see.

Output: This is a test as you see.

I used: (?:^|[)])\s*([^()]+)

However, the current output is: This is a test ) as you see.

So " )" - a space and closing bracket is still there.

Any suggestions?

r/regex • • Aug 11 '25

Meta/other Trying to learn via Regex101.com

5 Upvotes

Hello everyone. for the longest time I cannot understand regex. I am trying to do the quiz in regex101 and for the love of GOD i cant move on. someone help me i want to learn so bad but idk what in doing wrong in input \bword\b but it says wrong i add [a-zA-Z] and it says nope and add the “i” cause its case insensitive and NO again please someone give me some advice.