How to parse alphanumeric value?


Author
Message
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
I have a field which may have alphanumeric values like this:



AMDNY-0001253

AMDNJ-0011253

000001253

XXHAM 1253





I need to get the numeric part to do some calculations and then assembly the alpha + numeric part again. Is there any cool .Net function that would help me on this process instead of me looping the value backwards to get only the numeric part of 1253 in the above example?

Edhy Rijo

Replies
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I think I'd try RegexMagic. It looks really accessible, with the ability to build regex patterns without having to actually know regex (i.e. they've abstracted out many pattern matching concepts to a higher level...you can search for a SSN rather than having to know the regex ([0-9]{3}-[0-9]{2}-[0-9]{4}). It also can generate code snippets for you. And there is a free trial... Sounds like its worth a try to me!



http://www.regexmagic.com/

http://www.regexmagic.com/download.html



Regex Buddy is more useful if you already know regex (or want to learn it) and it doesn't have a free trial (but does have a nice money back guarantee).



My guess is that you'd still want to learn regex, but regex magic might make it possible to start using regex without the hours of trying to figure out how to build a pattern, which might actually increase the speed you learn it.
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Greg and all,



Just to let you know that today I finally had the opportunity to test a Regex match and replace and with the help of the RegexMagic I was able to create the correct pattern and replaced the previous flat condition which had to match several characters using String.Replace().Replace(), etc.



Once again, thanks for the contribution and push BigGrin nicely for us to move in the right direction Tongue

Edhy Rijo

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Glad to hear it! Sounds like RegexMagic is quite helpful.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Edhy Rijo - 15 Years Ago
Greg McGuffey - 15 Years Ago
Greg McGuffey - 15 Years Ago
Edhy Rijo - 15 Years Ago
Edhy Rijo - 15 Years Ago
Greg McGuffey - 15 Years Ago
Edhy Rijo - 15 Years Ago
Charles R Hankey - 15 Years Ago
Greg McGuffey - 15 Years Ago
Ivan George Borges - 15 Years Ago
                     Thanks Charles,

Believe me, taking a quick look at the...
Edhy Rijo - 15 Years Ago
                         Whatever tool you use notice there is a regex tutorial link on the...
Charles R Hankey - 15 Years Ago
                             I think I'd try RegexMagic. It looks really accessible, with the...
Greg McGuffey - 15 Years Ago
                                 Hi Greg and all,

Just to let you know that today I finally...
Edhy Rijo - 15 Years Ago
                                     Glad to hear it! Sounds like RegexMagic is quite helpful.
Greg McGuffey - 15 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search