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 remove whole block whoch contain this words

myzol+\s+(.*)-[0-9]+\s\{[\mrzulf\](.*?)\}
The lines
here is me
you are there
my fav

gvt
hjk hlkjhf c

myzol 123gbhj {
    test
    check      myself/mrzulf/.com
}

myzol 123gbhj {
    test
    check      myself/mrzulf/.com
}

myzol 1fde3gbhj {
    test
    check      myself/check/.com
}

myzol 12ecehj {
    test
    check      myself/mrzulf/.com
}

myzol 1evehj {
    test
    check      myself/check/.com
}

Here I have to remove the block which contains mrzulf
I have to replace it with blank.

>Solution :

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

There is no - in the example strings, and not all the examples end on a digit before the curly like in this part of the pattern [0-9]+\s\{

You can match:

\bmyzol+\s+[^{]*{[^{}]*\bmrzulf\b[^{}]*}

And replace with an empty string.

Regex demo

If there should be a space and word characters before the opening { then, and if you do not want to match newlines before the opening {:

\bmyzol+\h+\w+\h+{[^{}]*\bmrzulf\b[^{}]*}

Regex demo

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