Solved

regex expression for finding alphanumeric text

Posted on 2009-07-14
8
279 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

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…
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…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

617 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