Fordraiders
asked on
regex expression for finding alphanumeric text
vb.net 2003
I have Alphanumeric numbers in a string.
example:
APPLETON APPPB100D BUSHING 1" INSULATED
APPLETON APPPB150D BUSHING 1-1/2" INSULATED
I need a regex expression to examine the string...
If it sees a string starting with "APP"...STRIP THE "APP" and return the rest of the string.
But the string must be an alphanumeric string...
so the result would be:
APPLETON PB100D BUSHING 1" INSULATED
APPLETON PB150D BUSHING 1-1/2" INSULATED
temp = Regex.Replace(temp, "\sAPP([0-9A-Z])", " $1") <----- JUST GUESSING ...NOT WORKING ?
ITS DOING THIS: !
LETON PB150D BUSHING 1-1/2" INSULATED
thanks
fordraiders
I have Alphanumeric numbers in a string.
example:
APPLETON APPPB100D BUSHING 1" INSULATED
APPLETON APPPB150D BUSHING 1-1/2" INSULATED
I need a regex expression to examine the string...
If it sees a string starting with "APP"...STRIP THE "APP" and return the rest of the string.
But the string must be an alphanumeric string...
so the result would be:
APPLETON PB100D BUSHING 1" INSULATED
APPLETON PB150D BUSHING 1-1/2" INSULATED
temp = Regex.Replace(temp, "\sAPP([0-9A-Z])", " $1") <----- JUST GUESSING ...NOT WORKING ?
ITS DOING THIS: !
LETON PB150D BUSHING 1-1/2" INSULATED
thanks
fordraiders
ASKER
its cutting off the "APP" in the word..."APPLETON" in the string.
its needs to stay the same..
its needs to stay the same..
>If it sees a string starting with "APP"...STRIP THE "APP" and return the rest of the string.
I thought that's what your requirement is. You seem to be contradictory. Please explain in more details.
I thought that's what your requirement is. You seem to be contradictory. Please explain in more details.
ASKER
my original request:
"If it sees a string starting with "APP"...STRIP THE "APP" and return the rest of the string.
But the string must be an alphanumeric string..." <-----
"If it sees a string starting with "APP"...STRIP THE "APP" and return the rest of the string.
But the string must be an alphanumeric string..." <-----
Still do not understand. "LETON PB150D BUSHING 1-1/2" INSULATED" is an alphanumeric string.
What do you want to be returned from APPLETON PB150D BUSHING 1-1/2" INSULATED?
ASKER
sorry I'm talking about the tokens inside the string itself ...
APPLETON <---- does not qualify only alpha token.
APPPB150D <---- ALPHANUMERIC TOKEN...
sorry for the confusion...
APPLETON <---- does not qualify only alpha token.
APPPB150D <---- ALPHANUMERIC TOKEN...
sorry for the confusion...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> LETON PB150D BUSHING 1-1/2" INSULATED
Is it not what you want? Or is it the space at the start which is the problem?
What happens when you use
temp = Regex.Replace(temp, "\sAPP([0-9A-Z])", "$1")
Or
temp = Regex.Replace(temp, "\sAPP([0-9A-Z])", "")