What do 'lazy' and 'greedy' mean in the context of regular expressions?
What are these two terms in an understandable way?
View ArticleWhat is the position of an unmatched group in C++?
Let m be of type std::smatch . Suppose there is an unmatched group i. What ism.position(i) ? For that matter, what is m[i]?For example, considerstd::regex re {"^(a+)|(b+)"};string...
View ArticleRegex to identify all "special" characters
I have a table, sales, with a column, email_address. I want to filter out the records in the sales table that have any characters that are neither alphanumeric nor special characters. These include A-Z...
View ArticleAdding ?nocache=1 to every url (including the assets like stylesheet) behind...
Alright, this is due to the pain that godaddy gives me by implementing their own caching in a MANAGED WORDPRESS hosting. I looked it up and as it turns out, their flush caching facility is not...
View ArticleWhat is the purpose of .? in the regex (.?.+?)(?:\/([0-9]+))?\/?$
The following regex expression is used in rewrite rules to match page and post names in URLs in a WordPress install with 'Post name' set as the permalink structure:(.?.+?)(?:\/([0-9]+))?\/?$What is the...
View ArticleRegex to validate a whole URL (in PHP) incorrectly matches part of the URL
I was developing a simple regex to parse part of a URL, the regex must be able to capture part of the url in a named group, there are only a few allowed characters (a-z0-9 and -) if other characters...
View ArticleRegex to match start and middle of a string to parse Content-Type header
I'm trying to break a string into groups where the start and optional middle are matched, and also the part before and after the optional middle is captured in a group.This is my work-in-progress RegEx...
View ArticleHow to add text at the end of each line in Vim with specific pattern?
my yaml file:colors- black- white- red- greensize- big- small- mediumweight- 100- 200- 300...How can I add ":" to the end of each line that doesn't start with "- "?Result should be something like...
View Articleawk regex for repeated character
I'm trying to match repeated patterns in strings. I know i can use /^[0-9]{5}$/at least in perl, but this doesn't seem to work in awk or nawk (no gawk installed).Any alternative, other than...
View ArticleVim: Aligning columns by whitespace
what for a regex is needed for formating some lines from0 0 0 00 00 00 000 000 000 00 000 000 00 0 000 0 000to 0 0 0 00 00 00000 000 000 0 00 000000 00 0000 0 000?TIA
View ArticleGreasemonkey/ Tampermonkey @match for a page with parameters
I'm working on a script that must be executed in a certain page, depending on the parameters it has. The URL is like this:http://example.com/page.php?key1=value1&key2=value2&...And I need to...
View ArticleNegating a backreference in Regular Expressions
if a string has this predicted format:value = "hello and good morning"Where the " (quotations) might also be ' (single quote), and the closing char (' or ") will be the same as the opening one. I want...
View ArticleHow can I translate a PHP regexp with the /u modifier into a JavaScript regexp?
Recently I have created a regex, for my PHP code which allows only the letters (including special characters plus spaces), but now I'm having a problem with converting it (?) into the JavaScript...
View ArticleRegex character repeats n or more times in line with grep
I need to find the regex expression to find a character that repeats 4 or more times with grep.I know that the expression is {n,}, so if I need to find lines, for example, when the character "g"...
View ArticleSome capture groups seem lost when matching group repeatedly
Trying to parse the output of monitoring plugins I ran into a problem where the match result was unexpected by me:First consider this debugger session with Perl 5.18.2: DB<6> x $_0...
View ArticleHow do I combine 2 instances of java.util.regex.Pattern? [closed]
I have 2 different instances of java.util.regex.Pattern. How do I combine them so that both apply?My use-case is that I am building a search tool, and I am giving users the ability to add all sorts of...
View ArticleUse a regex to get text from html source code
I have got a php code that stores html source code of a site in a variable and I want to get two links from that source code only.First link is in meta tag key content:<meta property="og:image"...
View ArticleRegex to remove ANSI escape sequences from script output
I'm trying to write a regex to remove all that starts with '[' and ends with 'm' or ';' so that the following script will be purged of all its special chars:Script started on 2023-09-16 10:06:45-04:00...
View ArticleWhy telegram emoji numbers are not deleted when removing special characters
I have a telegram bot and I want to remove all special characters and just returns numbers and A-Z,but the problem is that my regex pattern can remove any emojies except numbers like this...
View ArticleHow to use RE OR Operand for Pandas RE .str.extract()
I've tried re-reading through the Python RE documentation before asking and searching around but don't see a duplicate question so far (which surprised me).Outside of a DataFrame I have my re working...
View Article