Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Google Sheets Regex for the inconsistent pattern

Attached are the Inputs and Expected Outputs based on which I wanted a common regex pattern which can be used in Google Sheets:
Input & expected output

Example:
In case of following string in a cell:
"30m DEVO-67, DEVO-68
1h DEVO-69, DEVO-70
2h DEVO-75"

Following should be the output:
DEVO-67, DEVO-68, DEVO-69, DEVO-70, DEVO-75

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Basically wanted to extract all the DEVO followed by Dash and a number from any given string.

I tried following but it is not working:

=REGEXREPLACE(B1,"[0-9]+\S+\s+DEVO-(\d+).*","DEVO - $1")

>Solution :

=REGEXREPLACE(A2,"(?is).*?(DEVO-\d+)","$1, ")

The idea is to select batches of

"Any unwanted string""DEVO-number"

and replace with

"DEVO-number",

with case insensitive matching and single line mode: (?is)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading