?
Solved

ASP regular expressions strings

Posted on 2005-03-08
8
Medium Priority
?
194 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
  • 3
  • 3
  • 2
8 Comments
 
LVL 97

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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 97

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 97

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

615 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