Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #79838

Re: Regex substitution trouble

Newsgroups comp.lang.python
Date 2014-10-28 05:28 -0700
References <8c1c1b7f-d121-4f3d-adf9-8262ddd8f102@googlegroups.com> <mailman.15258.1414495491.18130.python-list@python.org>
Message-ID <f65a31e0-0c8e-4f6d-808f-7a9468c2c1e2@googlegroups.com> (permalink)
Subject Re: Regex substitution trouble
From massi_srb@msn.com

Show all headers | View raw


Hi Chris, thanks for the reply. I tried to use look ahead assertions, in particular I modified the regex this way:

newstring = re.sub(ur"""(?u)(\$\"[\s\w(?<=\\)\"]+\")""", subst, oldstring) 

but it does not work. I'm absolutely not a regex guru so I'm surely missing something. The strings I'm dealing with are similar to formulas, let's say something like:

'$["simple_input"]+$["messed_\\"_input"]+10'

Thanks for any help!

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Regex substitution trouble massi_srb@msn.com - 2014-10-28 04:02 -0700
  Re: Regex substitution trouble Chris Angelico <rosuav@gmail.com> - 2014-10-28 22:24 +1100
    Re: Regex substitution trouble massi_srb@msn.com - 2014-10-28 05:28 -0700
      Re: Regex substitution trouble Chris Angelico <rosuav@gmail.com> - 2014-10-28 23:59 +1100
      Re: Regex substitution trouble MRAB <python@mrabarnett.plus.com> - 2014-10-28 17:52 +0000
  Re: Regex substitution trouble TP <wingusr@gmail.com> - 2014-10-28 06:25 -0700
  Re: Regex substitution trouble Tim <jtim.arnold@gmail.com> - 2014-10-28 09:38 -0700
  Re: Regex substitution trouble Cameron Simpson <cs@zip.com.au> - 2014-10-29 13:14 +1100
  Re: Regex substitution trouble Eugene <hexumg@gmail.com> - 2014-11-05 13:44 +0300

csiph-web