need help for regex

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts

  • R. Rajesh Jeba Anbiah
    Guest replied
    Re: need help for regex

    "Alex Shi" <chpshi@stonix. com> wrote in message news:<ZPt2c.743 69$oA1.72282@nn tp-post.primus.ca> ...[color=blue]
    > Hello folks,
    >
    > I want to retrieve full name, city name, state and country from
    > following string:
    > "(Firstname Lastname - Traverse City, MI United States)"
    >
    > I think maybe a regex can be a solution. However I don't have
    > much knowledge on it. I need help. Thanks in advance![/color]

    This might help you <http://www.weitz.de/regex-coach/>

    --
    "I don't believe in the God who doesn't give me food, but shows me
    heaven!"--Swami Vivekanandha
    Email: rrjanbiah-at-Y!com

    Leave a comment:


  • Tim Van Wassenhove
    Guest replied
    Re: need help for regex

    On 2004-03-07, Alex Shi <chpshi@stonix. com> wrote:[color=blue]
    > Hello folks,
    >
    > I want to retrieve full name, city name, state and country from
    > following string:
    > "(Firstname Lastname - Traverse City, MI United States)"
    >
    > I think maybe a regex can be a solution. However I don't have
    > much knowledge on it. I need help. Thanks in advance![/color]

    Have a look at http://be.php.net/manual/en/function.sscanf.php

    --

    Leave a comment:


  • John Dunlop
    Guest replied
    Re: need help for regex

    Alex Shi wrote:
    [color=blue]
    > I want to retrieve full name, city name, state and country from
    > following string:
    > "(Firstname Lastname - Traverse City, MI United States)"[/color]

    No more constraints? What does a state name look like, for example?

    preg_match(
    '`\((.*) - (.*), ([A-Z]{2}) ([^)]*)\)`sU',
    $string,
    $array);

    --
    Jock

    Leave a comment:


  • Alex Shi
    Guest started a topic need help for regex

    need help for regex

    Hello folks,

    I want to retrieve full name, city name, state and country from
    following string:
    "(Firstname Lastname - Traverse City, MI United States)"

    I think maybe a regex can be a solution. However I don't have
    much knowledge on it. I need help. Thanks in advance!

    Alex Shi

Working...