Python Forum
[solved] Regex expression do not want to taken :/
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[solved] Regex expression do not want to taken :/
#1
Hi everyone,

I've already used the module re a couple of times. but this time I have one expression that I can't pass to Python without getting an error

The expression
Quote:(?<=^([^"']|["'][^"']*["'])*)#.*

sample string to test expression upon
Quote:#this is a test
#this is another test
x = None #another test

"This is a string with # Hash symbol" #a comment right after.

on regexr.com this combo work.

but when I try in my python code

x = re.compile( r'(?<=^([^"\']|["\'][^"\']*["\'])*)#.*' )
I got
Error:
re.error: look-behind requires fixed-width pattern
Any ideas ?

Thanks
[Image: NfRQr9R.jpg]
Reply


Messages In This Thread
[solved] Regex expression do not want to taken :/ - by SpongeB0B - Nov-06-2023, 08:48 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Regex Include and Exclude patterns in Same Expression starzar 2 836 May-23-2023, 09:12 AM
Last Post: Gribouillis
  Help with a regex? (solved) wrybread 3 867 May-01-2023, 05:12 AM
Last Post: deanhystad
  [SOLVED] [regex] Why isn't possible substring ignored? Winfried 4 1,123 Apr-08-2023, 06:36 PM
Last Post: Winfried
  [SOLVED] Alternative to regex to extract date from whole timestamp? Winfried 6 1,881 Nov-16-2022, 01:49 PM
Last Post: carecavoador
  Regex Expression With Code Query In Pandas eddywinch82 8 2,403 Apr-13-2022, 09:12 AM
Last Post: snippsat
  Problem in Regex Expression shantanu97 2 1,757 Sep-28-2021, 03:40 AM
Last Post: shantanu97
  [SOLVED] Why does regex fail cleaning line? Winfried 5 2,501 Aug-22-2021, 06:59 PM
Last Post: Winfried
  Using Regex Expression With Isin in Python eddywinch82 0 2,315 Apr-04-2021, 06:25 PM
Last Post: eddywinch82
  2 regex expression at a time tokstolle 2 2,109 May-27-2020, 05:00 PM
Last Post: bowlofred
  Pass results of expression to another expression cmdr_eggplant 2 2,320 Mar-26-2020, 06:59 AM
Last Post: ndc85430

Forum Jump:

User Panel Messages

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