Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
re.sub not working
#3
Hello,

(Oct-02-2022, 04:50 AM)deanhystad Wrote: Some characters have special meanings in regular expressions, such as (). You obviously know this because your used backslashes to remove their special meaning in this:
re.findall('_+\s?\([^\)]+\)', text)
You could proces the regex strings to add in the backslashes, but it is easier to use str.replace().
We can use a rstring...
Ryokousha likes this post
I speak Python but I don't speak English (I just read it a little). If I express myself badly, please blame the translator^^.
Reply


Messages In This Thread
re.sub not working - by Ryokousha - Oct-02-2022, 04:18 AM
RE: re.sub not working - by deanhystad - Oct-02-2022, 04:50 AM
RE: re.sub not working - by Coricoco_fr - Oct-02-2022, 05:42 AM
RE: re.sub not working - by Ryokousha - Oct-02-2022, 07:06 AM
RE: re.sub not working - by Ryokousha - Oct-02-2022, 07:04 AM
RE: re.sub not working - by Pedroski55 - Oct-02-2022, 05:59 AM
RE: re.sub not working - by snippsat - Oct-02-2022, 11:34 AM
RE: re.sub not working - by deanhystad - Oct-02-2022, 03:00 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020