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

    Join Date
    Oct 2011
    Posts
    7
    Rep Power
    0

    Replace first instance only in every line.


    I'm using Emeditor, I would like to use a regex command which does the following. I would like to replace the first instance of an expression on every line. Example

    tomatoes are great . they are considered fruits . they're red.

    result:

    tomatoes are great : they are considered fruits . they're red.

    You can see that the first period was replace by a ":", but the second period did not change, as well as the last period. I want to convert only the first period of every line to become a semi-colon. Any help is appreciated.
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,965
    Rep Power
    9397
    Another way of putting that is to replace the first length of non-periods plus a period with that same first length plus a colon. Use ^ to match the beginning of a line.
    Code:
    Replace ^([^.]+)\. with \1:

IMN logo majestic logo threadwatch logo seochat tools logo