261,161 questions
Advice
0
votes
4
replies
56
views
Match a string not preceded by a pattern
I want to match a string according to a pattern but only when it is not preceeded by an other pattern.
const source = "abc.def.Ghi\n\
@:test(abc.def.Ghi2)";
const re = /(?!\()([a-z]\w+\.)+([A-Z]\w*)/g;...
-3
votes
1
answer
42
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
65
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\"...
5
votes
2
answers
126
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
121
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)...
-6
votes
1
answer
85
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
82
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
82
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
88
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
182
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
162
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 ...