Regex: extract value from double quotes [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 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.

Related

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 matches string#substring [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 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.

Regex to extract string between two slashes and a specified string in it [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 3 years ago.
Improve this question
I have as string like this /test/xychcm_prd/test/ss or /test/xychcmss_trn/test/ss. I want extract the string xychcm_prd or xychcmss_trn from it. Here _prd or _tst is predefined. The string is always between slashes. How do get this string using regex?
You can use this regex to found your string:
[^\/]*(?:_prd|_trn)
The [^/]* will take every character before the _trn or _prd except the slash and will stop at it.
The (_prd|_trn) will make the regex to search for _trn or _prd at the end of the string you want.
The ?: will make a non-capturing group from the (_prd|_trn) since you don't need it.
Live exemple

I want a regex to Start with but not end with a specific string for Autoit [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 5 years ago.
Improve this question
There are lots of examples out there but none worked as I want to match specific string not any character. Here is my example.
United.Book
United.Services.Cloud
United.Services.Sky
United.Services.Something- Copy
United.Services.Bolt
So I want a regex which will match only 2 and 3rd and 4th (should be United.Services* but should not end with copy). Have tried few but nothing worked
^United.S.*[^copy]$
Since you're not providing more specific limitations, here is the regexp that would match the requirement
should be United.Services* but should not end with copy
United\.Services(?!.*Copy$).*$
Here is the test: https://regex101.com/r/9WTngz/1
/^United.S.*[^copy$]/i
this regex matches the string all the way to the string copy. I added the i because the c in copy is uppercase you can omit it if you want to preserve case sensitivity

Regex Specific Match String [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 8 years ago.
Improve this question
Would some one please tell me the following Regex?
At least eight or more characters.
At least one lower-case letter.
At least one upper-case letter.
At least one number.
Thanks in advance.
Variation on Complex Password Regular Expression
You can use this lookahead based regex:
^(?=.*?[a-z])(?=.*?[A-Z])(?=.*?[0-9]).{8,}$