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

    Join Date
    Jun 2016
    Posts
    8
    Rep Power
    0

    regex with "-" separator and another string


    Hello,
    i have this format of string:
    MY TITLE OF STRING 5 - EP.2
    MY TITLE OF STRING 6 - EP.3

    But in some cases this rule jump and and my string can become that way:

    MY TITLE OF STRING 5- EP.2
    MY TITLE OF STRING 6-EP.3

    This is a my regex
    (\d*)\s-\s.*?EP.\s*(\d*)

    but works only standard case.
  2. #2
  3. Maddening Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,455
    Rep Power
    9645
    Code:
    \s-\s
    That requires a space on either side. If it each into \s* then it will match zero or more spaces.

IMN logo majestic logo threadwatch logo seochat tools logo