Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #23778
    BobBailey
    Participant

    I have a phone number that looks like this:
    +1(123) 456-7890 or maybe any variant of punctuation and spaces.
    +1(123)456-7890, 123-456-7890, 123.456.7890
    I want to end up with this:
    11234567890 or 1234567890
    I have tried all sorts of variants:
    [0-9]+
    ([\d]+)
    [0-9]+[0-9]+[0-9]+[0-9]+
    None of which seem to work. Ideas?
    Thanks… Bob
    PS I would think that this would be a fairly common problem but Google only turns up language specific solutions.

    #23779
    Stefan
    Participant

    FROM:
    +1(123) 456-7890 or maybe any variant of punctuation and spaces.
    +1(123)456-7890, 123-456-7890, 123.456.7890


    TO:
    1123 4567890 or maybe any variant of punctuation and spaces
    11234567890 1234567890 1234567890


    USE:
    Find: [(),.+-]
    Replace:
    [x]Use RegEx
    [Replace All]

    – – –
    Depending on your work, you can also include the space to the list of sings to become removed, like: [(),. +-]
    .
    .
    .

    #23780
    BobBailey
    Participant

    Hi Stefan,
    This is great and very useful. What I’m really looking for is a regex that returns the phone number with no punctuation. That is:
    +1(123) 456-7890 >>> RegEx >>> 11234567890
    Maybe this is not possible?
    Thanks… Bob

    #23781
    Mr KT
    Participant

    Hi BobBailey,
    Assuming you are running a fairly recent version of EmEd, try the following:

    Make sure your phone numbers are in a column (delimited file – e.g. tab, comma, etc.)
    Select this column.
    Search Menu – Replace (or Ctrl-H)
    In the Find field:([0-9])
    In the Replace with field:\0
    Make Sure the “Use Regular Expressions” and “In the Seleciton Only” check boxes are ticked.
    Click the Down arrow next to the Extract button and select “To New CSV Column”
    Click the Extract button.

    The phone numbers should be returned in a new column to the right of your original column (without punctuation).

    #23787
    BobBailey
    Participant

    Thanks to both of you for your suggestions. I’ve got what I need.
    …Bob

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.