Solved

regex expression for finding alphanumeric text

Posted on 2009-07-14
8
259 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
Comment Utility
>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
Comment Utility
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
Comment Utility
>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
 
LVL 3

Author Comment

by:fordraiders
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 83

Expert Comment

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

Expert Comment

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

Author Comment

by:fordraiders
Comment Utility
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
Comment Utility
temp = Regex.Replace(temp, "\sAPP([A-Z]*[0-9])", " $1")  
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now