261,162 questions
-5
votes
1
answer
128
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
42
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 (...
-6
votes
0
answers
53
views
Reverse Regex challenge: Can't pass a specific REGEX filter from the Binance Api [duplicate]
Using Python 3.10, I trying to send a (Binance Rest Api) passing parameter string that, however, gets rejected as it is reported not conforming to this REGEX:
\'^\\[("[A-Z0-9-_.]{1,20}"(,&...
5
votes
3
answers
150
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
80
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
156
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 ...
0
votes
0
answers
83
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
0
answers
52
views
how can i create a router to route en express? [closed]
i have a question about express route that i been struggling to figure it out. in my index.js file i have this
var express = require('express');
var app = express();
const PORT = 3000;
var users = ...
0
votes
0
answers
41
views
Non-greedy sub-regex hinders capture of optional sub-regex that follows [duplicate]
I'm trying to figure out a regular expression (Python 3.11) that finds a certain text and another text that may optionally follow a random number of places later. However I can't get it to work.
Here ...
2
votes
2
answers
60
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
2
answers
114
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
157
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
90
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
161
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) ...
2
votes
1
answer
120
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
\\...