Regex matches string#substring [closed] - regex

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am looking for a regex matches any string in the following format:
string#substring -> where substring = substring of the string and string is only letters from a to d
e.g.
abcddd#cd accepted
abcddd#cccc not accepted

This regex should meet your requirements:
[a-d]*?([a-d]+)[a-d]*#\1
It matches abcddd#cd but doesn't match abcddd#cccc.
Depending on your choice of tool and how you use it, you may or may not have to anchor it with a ^ and $ at the beginning and end respectively (turning it into ^[a-d]*?([a-d]+)[a-d]*#\1$).
Experiment here.

Related

Regular expression to match String Exactly with opening Round Brackets or Parentheses [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
Simple regex question. I have a string on the following format:
XYICD27A3 (MN PqrstUvw MFP E34540)
What will be the regular expression to match this string. I have tried:
(^([a-zA-Z0-9-_#&:.#$ s]+)$)
this, but it's not matching the whole string
According to your comment, I corrected your regex like this:
[a-zA-Z0-9\s]+\([a-zA-Z0-9_#&:.# -]+\)

How do I write a Regex pattern to match the following strings? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have string that could come in several forms
“PSM000216556880035450088|TRF”
“VNM000216556880035450088|TRF FROM MACK”
“NXG000216556880035450088”
“Transfer from josh SL000216556880035450088 to jack”
“X00000216556880035450088 0098123 TRANSFER 789121”
I need a Regex pattern that could get the string that starts with PSM, VNM, NXG, SL00 or X00.
i.e. in 1, I need “PSM000216556880035450088”. This string is the reference and it is what I need. It can be found in any position in a sentence and sometimes the reference might not be separated from the other words by a space. Sometimes a special character can be used as a separator. i…e. in 2 “VNM000216556880035450088|TRF FROM MACK”.
I will be using the Regex in my VB.NET code.
What about this with multiline flag?
((?:PSM|VNM|NXG|(SL|X)00)\d+)

Regex: extract value from double quotes [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
having a hard time to find regex solution.
The value in database's field "product_id" can be in either format:
{"value":"e19f2b3e-9919-421e-a125-95fdd989459d"}
{"itemUuid":"8fe2a09e-aade-485c-b847-e83a780f1b8e"}
Need to write a regex capturing BOTH cases, so the result will be:
e19f2b3e-9919-421e-a125-95fdd989459d
8fe2a09e-aade-485c-b847-e83a780f1b8e
What I already did (in Vertica syntax) is
trim(TRAILING '"}' from regexp_substr(me.value, '[0-9].*'))
which doesn't capture the id if it starts with alphabetic character.
You can use the RegEx (?<=:").+(?="})
(?<=:") makes sure there is :" before your match
.+ matches any char at least once
(?="}) makes sure there is"} after your match
Demo.

Regular Expression for set of double number with semi-colon delimeted [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Today I attemped several time to build regular expression to validate a set of double number with semi-colon delimeted following example data below:
Should match:
123.1234567890
123.1234567890;123.1234567890;123.1234567890
Should not match:
123.1234567890;
123.1234567890;123.1234567890;123.1234567890;
If you have any idea, Could you please help me ?
Thank you very much
You can try this:
(\d+\.\d+;)*\d+\.\d+(?![\d;])
to match the whole 123.1234567890;123.1234567890;123.1234567890
\d+\.\d+(?![\d;])
to match just the last.

What is the regular expression to find a string in log files with the following format: "Failures: [!0]"? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm looking for the regular expression to find failures in a log file.
The format is "Failures: " following the number of error, a digit not zero
Thanks!
You can use this:
"Failures:\s+[1-9]\d*"
this would be what you are looking for:
Failures:\s*[1-9]\d*
btw, you may want to know that in character class, the not notation is ^, not !.
E.g. [^a-zA-Z] means not letters.