Solved

regex expression for finding alphanumeric text

Posted on 2009-07-14
8
272 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 84

Accepted Solution

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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

740 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