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.
73
questions
0
votes
0
answers
10
views
Non-word characters in SHAP's default tokenizer
My basic question is: why are the non-word characters making it into my SHAP output, and how do I prevent it?
I am applying SHAP to a black-box machine learning model fn_predict_proba() (the model ...
-4
votes
0
answers
48
views
Why is using regex group feature on Python giving different outputs? [duplicate]
import re
string1 = "aaabaa"
zusuchen = "aa"
#1
m_start = re.finditer(fr'(?=({zusuchen}))', string1)
results = [(match.start(1), match.end(1)-1) for match in m_start]
for z in ...
-3
votes
0
answers
54
views
Getting text from a string [duplicate]
I am using this pattern below
<a href=.*##ENCLICKTAG##2104.*\s*<\/a>
To extract the first "a" tag content from this String below
<a href="##ENCLICKTAG##2104&&...
0
votes
1
answer
41
views
Detecting OR operator sequences and wrapping their content in a parenthesis when building a query with PHP
I made the following PHP code to build a query based on user input, where they can choose the condition and the operator and the resulting query would be printed on their screen every time they added ...
-1
votes
0
answers
27
views
Bash Regex Start Anchor w/Character Classes Not Working [closed]
GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
$> var=39Q08a
...
-1
votes
0
answers
11
views
query in elastic using regular expressions
I want to find the value of quality:0.60 from elastic using kibana. I have a log field containing the following text inside
1721901536 [01;30mDEBUG [00m tracker.cpp:92 [01;30mTracker[bf19311e0d65] ...
-1
votes
0
answers
22
views
Splicing Relavent Text from a Screenshot using pytesseract and ocr for Scheduling script
Hi I'm currently making a script that can take screenshots of a university class schedule and automatically sync it to either google calender or outlook calendar.
from PIL import Image
import ...
0
votes
1
answer
28
views
Issue retrieving City/State/Zip line from block of text
I have a bunch of blocks of text that will contain address information such as:
Fake Name
Business name
60 N Address Ave.
San Jose, CA 95126
(555)255-5555
Email: [email protected]
I need to ...
-1
votes
1
answer
56
views
How to search for and highlight matching text/phrases within the entire document-body's text-content?
I want to regex and replace only text content(innerText) of an html, and in the end keep all the HTML elements (or restore them as they were).
The regex must not check the HTML elements, but only the ...
0
votes
0
answers
31
views
Can I serve a git repo and html from the same URI?
I have a small static website, generated by a script which I want to distribute along with the source data. Thus if I make a hook which runs git update-server-info, the HTML will be at https://example....
1
vote
0
answers
26
views
Malformed CDATA in xml
I get a XML from a third-party service,
This one is malformed sometimes CDATA tag aren't close,
My goal is to write a regex capable of catching only malformed CDATA,
example :
<Couleur_regroupement&...
1
vote
1
answer
46
views
How to extract the volume from a string using a regular expression?
I need to extract the volume with regular expression from strings like
"Candy BAR 350G" (volume = 350G),
"Gin Barrister 0.9ml" (volume = 0.9ml),
"BAXTER DRY Gin 40% 0.5 ml&...
0
votes
1
answer
38
views
Regex to match lines followed by another Line
I'm working with a text input and i need a regex pattern to capture lines that are followed by another line. Specifically i want to match lines that end with exactly one newline character and are ...
-1
votes
0
answers
30
views
What are subtle cases when implementing regex grouping translator?
The following code is based on the book code base in MIT 6.5151 course.
Here "translator" means the code transforms the Scheme specific function into the POSIX regex expression.
This ...
3
votes
0
answers
30
views
Regex works in regex101 but not in VSCode - How to fix? [duplicate]
I'm trying to use a regular expression in Visual Studio Code to match a pattern in my text. The text is as follows:
Cat
AAAAAAAAAAAAAa
Dog
Cat
BbbbbbbbbbBbb
Dog
I want to match everything from "...