Link to home
Start Free TrialLog in
Avatar of weklica
weklica

asked on

Regular Expressions

I have a simple request:

I have something like this:

Lastname^Firstname^^^

sometimes

Lastname^Firstname^MI^^

What I need is a regular expression like ([^.]*).[^.]*.[^.]* that would show me just the Lastname as a result, then just the first name, then just the middle initial.

The example I pasted will do it if it is like Lastname.Firstname.MI, but I do not have any idea how to work with carrot symbols since those are already being used in the expression.
Avatar of weklica
weklica

ASKER

I thought maybe this, but that isn't it.  

([^^]*)^[^^]*^[^^]*
SOLUTION
Avatar of waltzing_wombat
waltzing_wombat

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ozo
([^^]*)
should be is sufficient for just Lastname
([^^]*)\^([^^]*)\^([^^]*)
should get Last, then First, then middle
Yup, my mistake, ozo's right, you gotta escape the carat outside the matching sets too.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of weklica

ASKER

Thanks Much!