Category "regex"

Print only non-blank lines in PowerShell

I have a text file with multiple lines. Many are blank, or so I am assuming from looking at the file contents. I would like to write/print only the lines that c

PHP: Check for characters in the Latin script plus spaces and numbers

I am new to regex and I have been going round and round on this problem. PHP: Check alphabetic characters from any latin-based language? gives the brilliant reg

Upgrade Ruby 2.6 to 2.7 - WebMock no longer recognizes RegEx patterns on stub requests

I am upgrading a Rails 6.1.4 application from Ruby 2.6.10 to Ruby 2.7.6. With Ruby 2.7.6, WebMock no longer matches the Regular Expressions that worked perfect

Regex: Extract digits separated by a hyphen

What I have: 123456789-987654321 What I need: 3456789-4321 (keep last 7 digits from 1st group and keep last 4 digits from 2nd group) (\d{7})- gets me

Regex that gets the last set of numbers from a string

"abc_d1.txt" should get 0 "abc_d1_2.txt" should get 2 "abc_d1_14.txt" should get 14 "abc_d12_x2_156.txt" should get 156 This is what I've done so far, but I am

Escaping back-references in recursive search

Is it possible to back-reference the result of an outer :g command in a recursive call (or an inner :s call?) For instance, let's say I want to search for somet

Remove a pattern from a character

I have a character like this: x = "abc [File: abcbdosln}} \n abc \n" And I want to remove File: abcbdosln}} \n from x so that the result would be "abc [ abc \n"

How to capture the field values in the csv file using bufferedreader

The csv file looks like this I'm trying to get the field values like name, it is the value after $$NAME$$ (there is a space after the identifier). How do I st

str_detect removing some but not all strings with specified ending

I'd like to remove any string that ends in either of 2 characters in a pipe. In this example it's ".o" or ".t". Some of them get removed, but not all of them, a

Retrieve array of substring matched with regex in swift

Is there any way to retrieve an array of words prefixed with @ sign in a string? "@City == xyz AND @Hobby == gardening" -> ["@City","@Hobby"] I tried below

Grafana exclude values from query with wildcard

I have a grafana query that sums a number of stats, my query looks like alias(summarize(sumSeries(stats.checkout-*.*.*.*.*), '$time', 'sum', false), 'checkout')

regular expression to return the uppercase message in parenthesis, after the process id

I want the extract_pid function to return the uppercase message in parenthesis, after the process id. Following code is printing pids but not sure how to add ca

checks the text for the presence of 2 or more characters or digits surrounded by parentheses, with at least the first character in uppercase

The contains_acronym function checks the text for the presence of 2 or more characters or digits surrounded by parentheses, with at least the first character in

Regex - Remove special characters but retain negative numbers

I'm building a Number Stepper component in React which needs to support integers (both positive and negative) and decimal numbers. I want to only hold the numer

IP Address regex with netmasks

the format goal: require a.b.c.d/x where >> a is 1-3 digit num btw 1-223 b, c, and d are 1-3 digit num btw 0-255 and *required x is 1 or 2 digit num btw 8

REGEXEXTRACT between strings but only display numbers in Google Sheets [closed]

I have a Google Sheets formula below, which extracts the contents between a multi line string: =REGEXEXTRACT(A2, "(?ms)mystring1(.*)mystring2"

AutoHotKey Date Parsing returning today's date

I had been working on a QoL macro to convert selected text dates into a desired format. For that purpose I was trying to utilize the DateParse function that is

Regular expression to stop at first match

My regex pattern looks something like <xxxx location="file path/level1/level2" xxxx some="xxx"> I am only interested in the part in quotes assigned to

failregex misses entries

I need to hit ›page not found‹ log entries like this one: 185.220.100.252 - - [13/May/2022:10:03:58 +0200] "GET /EXPLOIT.php HTTP/1.1" 404 14780 "

In Telegraf how to include only specific values of a tag

I am using a prometheus plugin in Telegraf to get the data from promitor and push it to InfluxDB. However, as per my requirement there is one tag named as "reso