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

Regex to get substring repeat in a string

I have strings like this "$a477tr.: $bBìa mềm ; $c13x18.8cm" and I wanna get the all substrings after $a, $b, $c, … . The expected results (included space):

$a "477tr.: "
$b "Bìa mềm ; "
$c "13x18.8cm"

I’ve used regex101 and tried the pattern but the result I got is

$a "477tr.: $bBìa mềm ; $c13x18.8cm". 

I’ve tried some other patterns but I couldn’t get the right results.

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

Please help.

>Solution :

(?<=\$[a-z0-9])(?<content>[^\$]*) should do the job.

: "${content}"\nthe substitution pattern if needed.

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