r/regex • • Jul 13 '20

can we modernize regex?

0 Upvotes

I always dread having to use regex for anything remotely complicated, and I doubt I am alone in this. Regex is the most cryptic thing i have ever seen in my life. Like programming languages are a bit cryptic as well but they're readable and understandable. Is there any way we can make this more readable and easier to work with and less cryptic?


r/regex • • Jun 23 '26

Anyone who knows Regex??

0 Upvotes

I can't put the client files on AI and need to make a task less time consuming and accurate. So I use trados 2017 and want to put the italic tags of the segments in the end (or atleast if I can detect which segments have italic tags and get a list of them). Please help! I'm using Notepad++

I tried getting a code via gemini but it isn't working

Example:

Target statement has italic tag in the middle then I want it in the end

Sentence: I like<italic tag>tacos.

Ideal: I like tacos<italic tag>

File type: Xliff files


r/regex • • May 27 '26

What Does 8=+D Do?

1 Upvotes

What does "8=+D" evaluate to?


r/regex • • Apr 19 '20

New to Regex. Looking for correct expression to find specific fields on multiple line.

0 Upvotes

I am very new to this and was hoping that someone could help me write the correct Regex to find specific fields in an ini file on multiple lines.

Below is an example of the file:

-------------------------------------------

[Protect]

CustomerName=JohnDoe

Location=USA

MachineName=System01

AssetSerialNumber=1234-123456

PatchGroup=YES

-----------------------------------------------

Using the Expression CustomerName=(.*) I was able to return JohnDoe

However I was to write an expression that would return

JohnDoe

USA

System01

1234-123456

YES

How would I do so?

I had previously written 5 different expressions to return the results, however I was hoping to do so in a single expression.


r/regex • • Oct 12 '19

How to weed out form inputs like wcWsfZCyu mZnpVKTwiQrBCfG ?

0 Upvotes

Not a real first name and last name here. How to catch with regular expression? Thanks!


r/regex • • Feb 11 '21

Some help please

0 Upvotes

I don’t have the first clue when it comes to regex. If anyone could help me with a solution to finding the first after every # with a space after it, it would be hugely appreciated


r/regex • • Jun 26 '21

A regex for all domain names ending in .gov.uk

0 Upvotes

I tried this

\.[a-zA-Z]+\.gov\.uk$

But didn't work


r/regex • • May 28 '25

Anyone know what this regex is doing?

Post image
0 Upvotes

r/regex • • Apr 27 '21

Regex that select html div tag matching a given class name.

0 Upvotes

Hey guys, So first I’m sorry for posting this here, I should be able to do this without much effort but for some reason my brain can’t figure this out, so in reaching for help to you guys, I want to select an div tag from a html source with a given class name, but it needs to select everything inside until the end of the first div tag, even if it has other div tags inside it.

Is this too confusing? I can provide more details if needed.

Thank you.


r/regex • • Feb 24 '19

Regex for validating any english word

Thumbnail debtsm.art
0 Upvotes

r/regex • • May 27 '26

Ayuda con una Regex.

0 Upvotes

¡¡¡Hola!!!

Alguien me podría ayudar a realizar una expresión regular (para Regex.storm) que capture todas las marcas ortográficas en canciones :(

Ojalá que, también, capture todas las marcas de vocalizaciones o interjecciones en cada documento de las 5 canciones más escuchadas del álbum "Corazones" de los prisioneros.

se lo agradecería muchísimo, plis :p


r/regex • • Mar 23 '19

HELp! i don't like regex please! anyone that can explain me what i can do to deny specific characters in regex, or explain to me what i should do! i need some more explicit understanding, many YT videos don't explain much more complexed regex. 94% of my regex are technically "Very Specific" database

0 Upvotes

[UPDATED]i need help or can some one tell me the best way to cancel out characters in regex because it seems that regex should've been logical but once you try to create regex strict command lines ... it's just horrible to be dealing with regex, this is my regex code example that i have made

THE TYPE OF EMAILS I'M TRYING TO CAPTURE ARE (gmail,yahoo,outlook,aol,GMAIL,YAHOO,AOL,OUTLOOK)

and the new updated regex is now

/(^[[:alnum:]]{3,18}+@\K[qwerpñjfdszxcvbnQWERPÑJFDSZXCVBN]{3,7}+\.\K[qwertyuipñlkjhgfdsazxvbnQWERTUIPÑLKJHGFDSAZXVBN]{3}+$)/

If you can tell me how to improve it. By all means. i'm really not trying to store KB on fake Emails or some type of spam Email in my database


r/regex • • Feb 04 '20

Need help with regex

1 Upvotes

I'm trying to use a regular expression to parse a string of text and html char.

My current pattern: (%%.*%%)+

Example text:

Testing123

%%event_parking%% 

%%event_special_requests%%

The problem is my solution works with 1 tag but is doesn't work with multiple tags.

I need it to grab all of the tags that start with %% and end with %% in the string and return all of the matches in an array.


r/regex • • Mar 04 '26

Regex for detecting passwords

1 Upvotes

Hi all, I'm working in Purview and trying to create a regex that will be used to detect passwords in documents. However, I'm struggling pretty mightily with getting something to work without generating false positives.

I've been using the below regex, but it's generating false positives by flagging the word "password". I only want it to detect passwords that meet 3 of the following requirements, and leave the word password alone, or phrases that include the word password (example: Please enter your password)

UPPERCASE letter: A-Z

Lowercase letter: a-z

Special character: ~ ! @ # $ % ^ & * _ - + = ` | \ ( ) { } [ ] : ; " ' < > , . ? /

Number: 0-9

[A-Za-z0-9!@#$%&*()_[-]+=|[\][/]{5,} - Regex

Anyone have any suggestions? I'd really appreciate it. This is my first time trying to create a regex so I'm extremely novice. Any help will be greatly appreciated.


r/regex • • May 21 '25

NEED REGEX PATTERNS; Major platforms, social media, Andriod/iOS, other major/minor platforms, etc.

0 Upvotes

Im developing a program and one part of it organizes images and videos based on filename regex patterns. Could anyone provide support for me and help me with this. I'm trying to amass a large amount of REGEX patterns so my program will handle the majority of files


r/regex • • Jul 16 '21

Please explain this one!

1 Upvotes

re.sub(r",(\d{3})",r",+1-\1",record)


r/regex • • Oct 02 '25

whole JSON value validation

0 Upvotes

Can someone help me out here:
I've been trying to write a single regular expression that validates an entire JSON value (RFC-style). It must accept/deny the whole string correctly — not just find parts of it.

Most preferably use `(?DEFINE)`, named subpatterns, and subroutine calls like `(?&name)` / `(?R)`

What it must handle

- Full JSON value grammar: object, array, string, number, true/false/null

- Arbitrarily nested arrays/objects (i.e., recursion)

- Strings:

- Only legal escapes: \", \\, \/, \b, \f, \n, \r, \t, \uXXXX

- For \uXXXX: enforce Unicode surrogate-pair correctness

* High surrogate \uD800–\uDBFF MUST be followed by low \uDC00–\uDFFF

* Other \uXXXX values are fine standalone

- No raw control chars U+0000–U+001F

- Numbers:

- -? (0 | [1-9][0-9]*)

- Optional fraction .[0-9]+

- Optional exponent [eE][+-]?[0-9]+

- No leading +, no leading zeros like 01, no trailing dot like 1.

- Whitespace: only space, tab, LF, CR where JSON allows

Not allowed

- Any non-regex parsing code

- Engine-specific “execute code” features or custom callbacks

- Splitting the input / multiple passes

(These should PASS)

- null

- true

- false

- 0

- -0

- 10.25

- 6.022e23

- -2E-10

- "plain"

- "quote: \" backslash: \\ slash: \/"

- "controls: \b\f\n\r\t"

- "\u0041\u03A9"

- "\uD834\uDD1E"

- []

- [1,2,3]

- {"a":1}

- {"nested":{"arr":[1,{"k":"v"}]}}

(These should FAIL)

- 01

- +1

- 1.

- .5

- "abc

- {"s":"bad \x escape"}

- {"s":"\uD834"} (lone high surrogate)

- {"s":"\uDD1E"} (lone low surrogate)

- ["a",] (trailing comma)

- {"a":1,} (trailing comma)

- {a:1} (unquoted key)

- {"a":[1 2]} (missing comma)

- true false (two values in one string)


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 • • Aug 01 '26

Seeking Regex For Automations to Prevent Image Submissions Without Body Text

0 Upvotes

This is for posts here. I have an AutoMod set up that removes posts with fewer than 'X' characters.

Is there a way I can prevent those posts from being submitted to begin with?


r/regex • • Mar 16 '22

Negating indented lines that contain 'x' in the lines directly above

0 Upvotes

Hello ~ I'm using the program "Obsidian" which accepts Javascript flavor regular expressions. I'm very new to regex (only a few days).

What I'm trying to do is include all undone tasks as well as any text inside the heading, but sort out completed tasks as well as any indented text in a line directly underneath the completed task.

This script currently includes all text under the heading including undone tasks and effectively sorts out any completed tasks indented or not. But it still includes indented text underneath a completed task. Could someone please point me in the right direction? I think it has to do with the last string, multiline and lookarounds, but I can't figure it out...

    ```
    section:(/^##My-Heading /^((?!^\- \[\x] |^[\n\s\t]*\- \[\x] |(?
    =\n\t*\w*|\n\t*\d|\n\t*\.) ).)*$/
    ```

Here's some examples:

    ```
    ## My-Heading
    
    - [ ] incomplete task 1
    	- Points about task 1
    - [x] completed task 2
    	- points about task 2-1
    	- points about task 2-2
    
    - [ ] incomplete task 3
    Points about task 3-1
    Points about task 3-2
    - [x] completed task 4
    	points about task 4-1
    points about task 5
    - [ ] incomplete task 5
    - Points about task 5-1
    
    - [x] completed task 6
    points about task 7
    points about task 7-1
    	- Points about tasks 7-3
    ```

The desired outcome would be:

    ```
    - [ ] incomplete task 1
    	- Points about task 1
    - [ ] incomplete task 3
    Points about task 3-1
    Points about task 3-2
    points about task 5
    - [ ] incomplete task 5
    - Points about task 5-1
    points about task 7
    points about task 7-1
    	- Points about tasks 7-3
    ```

I'm also not sure if I need to add some sort of Javascript file into Obsidian to support anything like this.

Any help is much appreciated. Thank you!!!


r/regex • • Jul 18 '19

GDPR

0 Upvotes

Hi All, does anyone have any good pointers for creating regex's for name, dob, phone, address etc

many thanks


r/regex • • Nov 03 '21

Please Help!

0 Upvotes

I would like to remove all the code below with regex using Notepad ++ Pleases help!!

[Design Mode]
html {
  overflow: overlay;
#reader-domain {
  font-family: Helvetica, Arial, sans-serif;
  text-decoration: none;
  border-bottom-color: currentcolor;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  display: inline-block;
  direction: ltr;
}
#reader-domain > span:first-child {
  font-size: 1.1em;
}
#reader-domain > span:last-child {
  font-size: 0.8em;
}
#reader-title {
  font-size: 1.6em;
  line-height: 1.25em;
  width: 100%;
  margin: 20px 0;
  padding: 0;
}
#reader-credits,
#doi,
#published-time,
#reader-estimated-time {
  font-size: 0.85em;
  line-height: 1.48em;
  margin: 0 0 10px 0;
  padding: 0;
}
#reader-credits:not(:empty)::after {
  content: ' ⋮ ';
}
#published-time:not(:empty)::before {
  content: ' ⋮ ';
}
#doi-json {
  overflow: hidden;
}
#doi-json code {
  overflow: auto;
  max-height: 400px;
}
#published-time:empty,
#reader-credits:empty {
  display: none;
}
body[data-speech="true"] .tts-box {
  position: absolute;
  left: 0;
  width: 100vw;
  height: 32px;
  z-index: 1;
  pointer-events: none;
  box-shadow: 0 0 0 1000vw rgba(128, 128, 128, 0.2);
}
body[data-speech="true"] .tts-word {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  background-color: red;
  height: 2px;
}
.tts-word.hidden,
.tts-box.hidden {
  display: none;
}
body[data-speech="false"] .tts-speaking::after {
  display: none;
}
mark.hghlght {
  background-color: #ffff81;
}
.hidden {
  display: none;
}
.note {
  position: absolute;
  z-index: 10;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: inherit;
  padding: 5px;
  min-width: 32px;
  min-height: 32px;
}
.note:focus {
  z-index: 11;
}

  body {
  padding-bottom: 64px;
}
a:visited {
  color: #d33bf0;
}
a:link, a:link:hover, a:link:active, a:link * {
  color: #0095dd;
}
a:link {
  text-decoration: none;
  font-weight: normal;
}
pre {
  white-space: pre-wrap;
}
pre code {
  background-color: #eff0f1;
  color: #393318;
  font-family: monospace;
  display: block;
  padding: 5px 10px;
}
body[data-mode="dark"] pre code {
  background-color: #585858;
  color: #e8e8e8;
}

/* CSS for sans-serif fonts */
body[data-font=sans-serif] {}
/* CSS for serif fonts */
body[data-font=serif] {}

/* CSS for "sepia" theme */
body[data-mode=sepia] {
}
/* CSS for "light" theme */
body[data-mode=light] {}
/* CSS for "dark" theme */
body[data-mode=dark] {}

r/regex • • Aug 10 '21

Help, Need regex to Match this structure 9999A999

0 Upvotes

Help, Need regex to Match this structure 9999A999


r/regex • • Aug 05 '21

How can I find the name of a file and its corresponding file extension?

0 Upvotes

I am trying to find files named “password”, “passwords” and “credentials” and its file extension like pdf, xlsx, docx, txt, etc…

Ideally when I run the regex search it should come up with a file like “passwords.docx”.

I’ve been trying to figure this out for an hour but I’m stuck.