261,160 questions
-2
votes
1
answer
28
views
Using Regex in Google sheets to extract a specific string [duplicate]
Using Regex in Google sheets, I need to extract "content1" in a separate cell (B1) from the 1st bracketed set without the brackets
This entire string will appear in cell A1:
[content1] [...
-6
votes
1
answer
61
views
Backslash escaping issue in AI generated answers [closed]
So, there is a websocket server (game) and requires socket.io messages like this: 42["game:chat-public:msg","{\"id\":\"2qxgs2\",\"pId\":\"nfityk\"...
3
votes
1
answer
95
views
Hex escape sequences in bash regex range have no effect
Here is a bash script:
#!/bin/bash
char=$'\x01'
if [[ "$char" =~ ^[\x01-\x20\x7F-\xFF]$ ]]
then
echo "Unprintable"
else
echo "Printable"
fi
The script ought to say ...
-2
votes
1
answer
111
views
Regular expressions for extracting text inside curly brackets [closed]
I'm working with some marked text and I need to extract information in order to use later. I want to use regular expressions from Python using the module re, but I can't construct the right expression....
-1
votes
2
answers
74
views
Force sumif() with wildcard and fixed pattern
I have a Google spreadsheet with the following values:
+------------+-----------------------------+
| G | F |
+------------+-----------------------------+
| Hours (G)...
-5
votes
1
answer
79
views
Best way to extract a names from a string [closed]
I have a function that takes a string as an input and tries to extract the name and surname. It is a combination of NER and regex to try to extract the names present. Is there a better or more ...
-3
votes
0
answers
80
views
How to delete evertything after .txt [closed]
I have tried \txt.*$, (^.*?\.[txt]+)(.*)$, (^.*?\.[.txt]+)(.*)$ and nothing matches
Here is an example of the file:
download_list/list_left/14khashintipasswordai.txt
download_list/list_left/...
0
votes
1
answer
67
views
How to access named capture groups in C++? [duplicate]
On Regex101, I have simple Regex with a named capture group in ECMAScript flavor:
(?<name>.*)
I'm trying to do the same thing in C++:
#include <iostream>
#include <regex>
using ...
1
vote
2
answers
81
views
Replace a long case statement involving regex with a hash
I'm parsing a number of text files of different formats. Some are csv, some are xml and some even txt. I have a case statement that checks if a certain string is contained in the first 100 bytes of a ...
-3
votes
0
answers
87
views
secure removal of tags from HTML content [duplicate]
The classical problem of HTML tag removal, to obtain a plain text content, may be usually addressed with patterns like : <[^>]+?>.
But what if you got this kind of content : <exampletag ...
-3
votes
2
answers
180
views
Regex to match all but this pattern [closed]
I have filenames with this pattern [a-zA-Z0-9]{10} and .txt extension. They might also contain a pattern like this [super] and it could be either before or after [a-zA-Z0-9]{10} with '_' separating ...
-4
votes
2
answers
111
views
RegEx in Javascript, Match multiline text between Tokens [closed]
I have this RegEx in JavaScript:
/^\d{4}-\d{2}-\d{2} ([a-z,]*)((.|\n|\r)*?)/mig
2025-11-13 bb Test.
2025-11-12 bb Mail von Test
testd
trest
Tes
2025-11-12 bb Mail v
Regex101
but I need the ...
Best practices
0
votes
4
replies
97
views
How to search through Unicode text with ASCII input in Python
I have a corpus of text which includes some accented words, such as épée, and I would like people to be able to easily search through it using ASCII input. Ideally, they would simply type protege or ...
2
votes
3
answers
161
views
Substitution problem for 2 same instances in one string by using regular expression substitution method [closed]
There is a task that says to replace NOUN words with any noun word possible while using regex substitution but issue is that, there are two of these words and each should be replaced separately.
The ...
5
votes
3
answers
166
views
Regex function to extract numbers from string-type values, separated by "-", to get the difference of each two values
I'm 100% new to Regex so I've been floundering about on regex101 trying to figure out how to get my desired output. I am using PostgreSQL to write a query to extract a set of values from the string. ...
-4
votes
1
answer
110
views
Escape characters issue when defining a regex in a JSON string [duplicate]
I am trying to extract values for colorName from the following strings located in <script> of an HTML page.
\\"colorName\\":\\"GLOSS REDSKY SHDWSIL WHT IMPASTO\\"
\\"colorName\\":\\"GLOSS ...
Best practices
0
votes
7
replies
161
views
Oracle - how to extract the date from string?
I am trying to find the right pattern which can extract the date from any string
"""
28/11/22 11-23333 to 28/11/22
11-23333 28/11/22 to 28/11/22
something 20.02.2022 end to 20....
-2
votes
0
answers
63
views
Colon in bash regex [duplicate]
I am using regex in GNU bash, version 4.4.23(1)-release (x86_64-pc-msys) (git bash).
I am having an issue indicating a colon to the regex.
I am looking for the following string:
Date : 25 Dolahn(6)
...
2
votes
2
answers
127
views
Non-repeating patterns
I am trying to find lines where pattern does not repeat its value.
I have a CSV file like this:
2025-10-20;71149;WZ/OPM/04757/12/2023;-220.83;7622100598299;-1;1027144
2025-10-20;81142;WZ/OPM/04993/08/...
1
vote
1
answer
84
views
VS Code lone quantifier brackets error when trying to match a single parenthesis
Using VS Code's find and replace, I am attempting to match several lines of any text up to the first parenthesis followed by a newline:
[\s\S&&[^\(]]+\(\n
This works fine on regex101, but ...
1
vote
1
answer
123
views
How to specify only one instead of multiple of a character in a row in grep regex?
I am trying to use a single grep command to search for all instances of $ until a single =
I have the following command so far grep -E '\$.*=' which returns all lines with a $ and then a = but it also ...
0
votes
2
answers
184
views
Split a string into an array but ignoring blank lines [duplicate]
I'm trying to get a relatively simple regex working the way I want it to. I'm trying to split a string into an array but ignoring blank lines.
Here's what I've got so far
const regExp = /\s*(?:\n|$)\s*...
0
votes
0
answers
80
views
Debug configuration build with OR'ing std::wregex constansts throws an unexpected std::regex_error exception
I'm compiling this with VS 2022 C++ compiler, as "ISO C++20 Standard (/std:c++20)" for a Debug configuration.
How come this throws the following std::regex_error:
regex_error(error_backref):...
4
votes
0
answers
114
views
C++ std::regex matches UTF-8 characters unexpectedly [duplicate]
I'm encountering unexpected behavior with std::regex when matching strings containing UTF-8 characters.
#include <iostream>
#include <regex>
#include <string>
bool matchPattern(...
-1
votes
2
answers
167
views
Java regex - Optional Match Capturing Group [closed]
I'd like to process some input queries in 3 possible ways:
query: select * from People
query: select * from People exclude addresses
query: select * from People include department
I have two regex1 ...
0
votes
4
answers
156
views
Splitting a long source string results in undesired elements in result list
Example:
import re
source_string ="2025-05-22 08:15:41 - Lorum Ipsum One\n\n2025-05-23 09:12:27 - Lorum Ipsum Two\n\nAnother line of text\n\n2025-05-24 13:33:45 - Lorum Ipsum Three"
...
-7
votes
1
answer
169
views
How to remove optional prefixes and suffixes from string
Product codes may contain 5 different prefixes CK0, CK, C, 0, K0
and two character suffixes from AA to AZ: AA,AB,...,AZ
Sample codes:
CK04721310AE
CK04721310AD
CK04721310AC
CK04721310AB
4721310AE
...
0
votes
0
answers
47
views
textfsm is also matching \n while matching the \w+ expected [duplicate]
I want to exterect Name and Age through ^(\w+)\n(\d+)$ and it is working.
if I use textfsm Why it is not giving data in correct format?
data:
Alice
37
Smith
41
template:
Value Names (\w+)
Value Ages (...
9
votes
4
answers
224
views
How to find what characters in a string are making it to not match a regex pattern?
Having this regex pattern (in c#):
^\d{2}/\d{2}/\d{2} \d{2}:\d{2}:\d{2}$
this string will match:
11/10/25 17:22:31
but this one will not (it just has an added "X")
X11/10/25 17:22:31
...
1
vote
2
answers
104
views
add special characters "[" in print text using awk
this is a part of my bash script
..
mytstamp=$(date '+%Y-%m-%d %H:%M:%S :: ')
output=$(gawk -v mt="$mytstamp" -f print_errlog.awk errlog.txt)
..
my file: <errlog.txt>
2025-10-11 14:25:...
2
votes
4
answers
194
views
Regex to split on %[A..Za..z]
I am attempting to tokenize clock format strings from TCL in C# program using Regex.Split(). For example
%A %B %d %Y or %A_%B sometext %d_%Y
I tried a regex split on @"(%[a..zA..z]) but it ...
1
vote
0
answers
341
views
VS Code chat.tools.terminal.autoApprove fails to match my command
I'm trying to configure VS Code's chat.tools.terminal.autoApprove setting to automatically approve specific curl commands to localhost when using GitHub Copilot agent mode. However, while simple ...
2
votes
2
answers
76
views
Get spaces count between nearest non-space character and given index
I have a string:
ONT ONT ONT Auto-neg Speed Duplex Port Flow Native Priority
And i need to get Auto-neg from it (for example).
I have start index of this word, for example 24.
I ...
0
votes
1
answer
135
views
Regex not capturing correct group [duplicate]
I need to capture the third instance of a pattern using regex. My code works using the online R Regex Tester, but not with the stringr::str_extract() function.
What is the reason for this?
string = c(&...
1
vote
1
answer
173
views
String manipulation in R, conditional capture and conditional append. ?regex solution
I am using hospital data. I want to make a regex expression in R and I am struggling to do this without using string manipulation outside of a single regex expression.
The string I want to search is:
&...
2
votes
1
answer
102
views
How to parse multiple email addresses from json data in Ansible via map(regex_search) filter
I've been trying to parse email addresses from the below json data:
"msg": [
{
"fqdn": "www.westero.local",
"function": "",
...
7
votes
1
answer
185
views
PCRE regular expressions backtracking control
Studying PCRE syntax documentation, I came to the "Backtracking Control" section:
The following act immediately they are reached:
(*ACCEPT) force successful match
(*FAIL) ...
3
votes
1
answer
142
views
Get left-most match instead of right-most
I have this regex:
^\\.+, .+\\([0-9]+) - .[^\\]+(.*)
I need to match a number in a bunch of paths however it's returning the right-most match when I need it to return the left-most match.
Examples
\\...
0
votes
3
answers
267
views
Requesting a RegEx pattern recommendation to match text in XML tags that spans multiple lines
Assume an XML node such as this:
<Person>
<DOB>11181928</DOB>
<LastName>Mouse</LastName>
<FirstName>Mickey</FirstName>
<City>Los Angeles&...
0
votes
2
answers
114
views
Search / replace in R with a capture group
In a Quarto book, I mention R functions as back-quoted strings in text like this, always ending in ()
test <- "The functions `lm()` and `car::vif()` are good test cases"
I would like to ...
2
votes
1
answer
74
views
is there a way to combine replacing byte-strings with regex strings? [duplicate]
I have some (working) code that searches for and modifies text within a PDF file.
it takes a list of "strings" that I want to find, and replaces each with a string of
spaces that is the same ...
-4
votes
2
answers
129
views
Eliminate part of a string with look-behind
I have a json file which has to be decimated based on the following rule: There are {"ItemID",..."createdAt"...} entries. Sometimes the part "Bilderliste": is followed by ...
4
votes
2
answers
180
views
How does PCRE \p{N} define a "numeric character"
In PCRE-regular expressions, \p{N} is supposed to match "Any kind of numeric character from any script". According to descriptions on RegexInfo and also on sidebar-explanations on regex101....
-3
votes
1
answer
111
views
Using Regex in Google sheets to extract a word within a naming convention [closed]
I would like to know the Regex formula in Google sheets to extract the word after the second square bracket ( ] ) and before the dash ( - ) from this string: [Blog] Banking-
So in this case, it ...
1
vote
4
answers
249
views
Multiple replaces between markers but not outside them
To avoid some confusion and questions, I changed the new string to "letters", so it would not match "text", so to avoid infinite loops.
I work under Windows, with the perl provided ...
-7
votes
1
answer
114
views
I got this error in React - "Uncaught TypeError: Cannot read properties of undefined (reading 'match')" can someone help me please? [closed]
I'm creating a video game search app. I'm using an API so that clicking a searched game card takes you to a new page that contains images and a brief intro about the game. However, this does not work, ...
1
vote
2
answers
203
views
Apply css just to number and symbols
Apply css just to digits
How to apply CSS only to numbers in paragraph? (without <span>)
How to apply css to only numbers in a text inside/or any <p><p> element?
When we look at the ...
1
vote
1
answer
108
views
REGEX_EXTRACT() with multiple capturing groups not returning what's expected
The following code shows my problem, I need to extract the JOBD value (with in reality variable and matches \w{1, 10}
with A (N, STR) as (
values
(1, 'SBMJOB MYJOB'),
...
0
votes
2
answers
101
views
VBA Code to Highlight Only Certain Instances within String
I'm currently stuck with my VBA code to get the precise part of the string highlighted.
The ask: I need to identify within the string where TEMPO and TSRA are and change the font to bold red for ...
2
votes
1
answer
94
views
Why does hitting enter in a textbox cause my regex to fail [duplicate]
I have a regex on a textbox in order to limit it to specific characters. It includes the following /^([A-Za-z0-9 .,':;/?()!-]|\\[rn])*$/
I am validating onBlur and displaying an error message when the ...