#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2007
    Location
    England
    Posts
    25
    Rep Power
    0

    Find and Insert?


    Right, I've found what I want to using:
    \d/\d

    Now I want to insert a \n after what is found rather than replace.

    How do I do it?

    Thanks
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2007
    Posts
    765
    Rep Power
    929
    It depends on what your regular expression engine supports.

    If you have zero-width look behinds, you can match the position just after your expression without matching any text (in Perl syntax, "(?<=you_regex_here)" ).

    Otherwise you can capture the matched text and then replace it with itself (In Perl that would be a replacement of "$1\n")

    Comments on this post

    • ManiacDan agrees
    sub{*{$::{$_}}{CODE}==$_[0]&& print for(%:: )}->(\&Meh);

IMN logo majestic logo threadwatch logo seochat tools logo