Questions tagged [regex]
Regular expressions provide a declarative language to match patterns within strings. They are commonly used for string validation, parsing, and transformation. Specify the language (PHP, Python, etc) or tool (grep, VS Code, Google Analytics, etc) that you are using. Do not post questions asking for an explanation of what a symbol means or what a particular regular expression will match.
260,594
questions
1
vote
1
answer
40
views
How to use replace text using a regex in a Pandas dataframe [duplicate]
I have the following dataset:
meste = pd.DataFrame({'a':['06/33','40/2','05/22']})
a
0 06/33
1 40/2
2 05/22
And I want to remove the leading 0s in the text (06/33 to 6/33 for example). I ...
1
vote
2
answers
20
views
In google sheets, how do I compare a cell to a range of regular expressions
I have a column that contains a number of different regular expressions, like this:
Regex Patterns
^abc
^def
^ghi
...
^xyz
I have another column with some strings:
Strings
abc123
def456
I ...
-2
votes
0
answers
18
views
matching nested two-part patterns [closed]
I am processing various text strings to extract parameters and values for use in a 'parameters' table. These strings vary in size and complexity, so it's not like I can expect a consistent syntax. ...
-1
votes
0
answers
7
views
Match urls starting with http and end with a domain using regex [duplicate]
I have a very large string where it might contain 'http' urls from 'mysite'. I want to match instances of these urls.
I tested the following regular expression to match the urls /^http:\/\/(.+?)mysite....
1
vote
1
answer
41
views
Datadog Regex is not replacing the right data
I am using Datadog Sensitive Data Scanner to redact some sensitive data from my logs. Datadog Sensitive Data Scanner supports Perl Compatible Regular Expressions (PCRE).
Example of a line of log:
...
1
vote
0
answers
42
views
Regex that allow alphanumerics, spaces, dots, hyphens, but not an empty string
I have this REGEX in Java that alllow simple short sentences with alphanumerics, dots, hyphens and white spaces:
Pattern MAX_LENGTH_30_NO_SPECIAL_CHAR_ = Pattern.compile("[A-Za-z0-9\\s\\-.]{1,30}&...
1
vote
1
answer
40
views
Regx pattern for Pyspark: match start and middle of a text and extract the middle
I have text in a pyspark column called TEXT that look like below:
The sky is red. I have 2 apples and I am fine.
----------------------------------------------
The sky is back. I have 8 apples or I am ...
-4
votes
0
answers
35
views
JavaScript Validation regex to allow only alphabet text or alphanumeric only [duplicate]
I need Javascript validation regex to allow only alphabet text or alphanumeric only.
Example -
dGgs1s23 - valid
12fUgdf - valid
abchfe - valid
ABFGC - valid
121232 - invalid
abd()* - invalid ...
-2
votes
0
answers
31
views
Regex code to read out coordinates from a single line [duplicate]
I have a string from which I want to read the coordinates for the X axis.
Here my String:
G74X106.5Y-49.Z-22.6P1800Q51000F0.28R0.1
Here what i like to get:
106.5
In addition, the whole thing should ...
1
vote
1
answer
36
views
How to parse pdf in r and then correctly convert or extract spaced/tabbed pieces of text into columns of dataframe?
I am reading a pdf in r using library(pdftools)
library(tidyverse)
library(pdftools)
library(lubridate)
pdf_rowwise <- strsplit(pdf_text("V://path//sample.pdf"), split = "\n")
...
2
votes
1
answer
27
views
Match list of host in mongo query doesn't work
I have below query :
mydb.my-collection.aggregate([
{
$match: {
$and: [
{timestamp:
{
$gte: $__timeFrom,
$lte: $__timeTo
}}
...
3
votes
1
answer
60
views
Parsing formulas efficiently using regex and Polars
I am trying to parse a series of mathematical formulas and need to extract variable names efficiently using Polars in Python.
Regex support in Polars seems to be limited, particularly with look-around ...
2
votes
1
answer
51
views
How can I expand a regex to find the entire URL in these cases?
I need to match complete blogger.googleusercontent.com image link URLs that include the /img/a/ subdirectories. The URLs are for images, and the file names don't have file extensions, but that may not ...
-4
votes
0
answers
36
views
regex is failing in first char itself [closed]
^[^\s][\/s]*[A-Z0-9][A-Z0-9\.\,\:\;\/\-]*$
above is regex if i enter M it is failing or does not match.
what changes i can make in above regex?
1
vote
2
answers
60
views
How to extract or capture the value from stdout_lines of an Ansible playbook?
I am looking for help to extract or capture the free MB value from the stdout_lines of an Ansible playbook execution and use that value as a criteria to proceed further in the playbook.
My task output ...