Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

regex expression for finding alphanumeric text

Posted on 2009-07-14
8
Medium Priority
?
293 Views
Last Modified: 2012-08-14
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
0
Comment
Question by:Fordraiders
  • 4
  • 3
8 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 24850086
>ITS DOING THIS: !
>  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])", "")
0
 
LVL 3

Author Comment

by:Fordraiders
ID: 24850217
its cutting off the "APP" in the word..."APPLETON" in the string.
its needs to stay the same..


0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 24850440
>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.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 3

Author Comment

by:Fordraiders
ID: 24851008
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..."  <-----
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 24851147
Still do not understand. "LETON PB150D BUSHING 1-1/2" INSULATED" is an alphanumeric string.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 24851150
What do you want to be returned from APPLETON PB150D BUSHING 1-1/2" INSULATED?
0
 
LVL 3

Author Comment

by:Fordraiders
ID: 24851200
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...
0
 
LVL 85

Accepted Solution

by:
ozo earned 2000 total points
ID: 24851366
temp = Regex.Replace(temp, "\sAPP([A-Z]*[0-9])", " $1")  
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question