Skip to content
Advertisement

Ignore text from dot to a specific character with regex python

I have a text like this:

JavaScript

i want a regex code that is able to delete the text inside the quotes and the text before it till the dot.

so the output be like that :

JavaScript

the code am stuck into :

JavaScript

what the code actually does is delete a more than expected here’s an example :

JavaScript

the output i get is like this :

JavaScript

Advertisement

Answer

You can use

JavaScript

See the regex demo.

  • (.) – Group 1 (1 in the replacement refers to this captured value): a dot
  • [^.]* – zero or more chars other than a .
  • «[^«»]*» – a substring between « and » without other « and » inside.

See a Python demo:

JavaScript
Advertisement