?
Solved

ASP regular expressions strings

Posted on 2005-03-08
8
Medium Priority
?
193 Views
Last Modified: 2010-04-06
I tried to do this in SQL but its getting a little complex.

So i think i do it all in VBSCRIPT ASP

DFC 5.6-07.15.04-LAN=ENG.pdf
DFC 6.2.2 -08.01.04-LAN=ENG
DFC 6.3-09.01.04-LAN=ENG.pdf
DFC 7.1-8.15.04-LAN=ENG.pdf

What im trying to do is get
5.6-07
6.2.2
6.3-09
7.1

What the best way to set up regular expressions to check string is in format
0
Comment
Question by:TRACEYMARY
[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
  • 3
  • 3
  • 2
8 Comments
 
LVL 96

Expert Comment

by:Lee W, MVP
ID: 13488054
I'm not sure what you are trying to do... can you clarify further?
0
 
LVL 49

Assisted Solution

by:Roonaan
Roonaan earned 1000 total points
ID: 13488074
On first glance the cases "5.6-07" and "7.1" contradict.

You would be unable to either:
- write a regexp which matches "5.6-07" and still only take "7.1" as a result on the 4th case, nor
- write an regexp which accepts only "7.1" in the case of "7.1-8.15.04" and still return "5.6-07" in the first case.

-r-
0
 
LVL 7

Author Comment

by:TRACEYMARY
ID: 13488233
Let me go ask the guy here what he wants cause the data is all over the place.

DFC 5.6-07.15.04-LAN=ENG.pdf
DFC 6.2.2 -08.01.04-LAN=ENG
DFC 6.3-09.01.04-LAN=ENG.pdf
DFC 7.1-8.15.04-LAN=ENG.pdf
Form 8.2.2-1-10.11.04-LAN=ENG.pdf

I think the first part is the number 8.2.2-1 then it becomes the date

so sometimes there could be just a -1 but then sometime it is the date

I be back.....
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 96

Expert Comment

by:Lee W, MVP
ID: 13488254
If the dash is the delimiter, that becomes much easier.
0
 
LVL 49

Expert Comment

by:Roonaan
ID: 13488320
As from now the thing I could think of would be like the reg below, but that one is PCRE and i'm not sure if that's ASP compatible?

/^     [a-z]+\s+([0-9\.\-]+)        \-[0-9\.]{8}       \-[a-z]+.*$/i

-r-
0
 
LVL 96

Accepted Solution

by:
Lee W, MVP earned 1000 total points
ID: 13488482
I would suggest replacing all delimiters with a common delimiter then using split to break it up into an array.  For example, assuming the data is in a database field, RS("data") and:

Do Until RS.EOF
   strData = RS("Data")
   strData = Replace(Replace(StrData, " ", "-"), "=", "-")
   arrayData = Split (strData, "-")
   'Do something here - ArrayData(2) should be equal to 6.2.2 and other numeric strings.  Do whatever you need to with that here.
Loop

0
 
LVL 7

Author Comment

by:TRACEYMARY
ID: 13488762
You know what.....................i have decided to make the user put in the revision number in the database
so i added another column and they have to update it ......................

Because i could have a number of different typo's formats ..........

Im not sure i like what if.......(if it is an exact format then its fine and i shall force that into database but its a nice text format).


Thanks all

0
 
LVL 7

Author Comment

by:TRACEYMARY
ID: 13517239
Oh got another part to this...
 Form 5.6 -01 Management Review Summary
All i need to do now is just get the Text after the numerics...

Can you help
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

I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses

752 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