Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Regular Expression problem

    I am newish to regex's, but I don't understand why this does not work:

    re.sub('\/\/(.*)/n' , "\n", inputstr)

    what I am trying to do is replace all the chars in inputstr between "//" and <newline> with a newline char.

    Can someone please explain to me how the RE should be made?

  • #2
    New Coder
    Join Date
    Dec 2009
    Posts
    38
    Thanks
    3
    Thanked 0 Times in 0 Posts
    you need do get rid of the second '/', it makes it think that the parenthesis are not meta characters.
    Open source. DO IT!!! SUPPORT IT!!! PREACH IT!!!
    -- The JSNerd


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •