Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Regular expressions and Code Reference
Message
De
20/12/2008 04:00:03
 
 
À
19/12/2008 22:20:57
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01368937
Message ID:
01368940
Vues:
18
This message has been marked as the solution to the initial question of the thread.
>Hello All,
>I am trying to search for any comments in my code dated between 10/01/08 and 12/19/08 using code reference. In the “Look Up Reference” screen I checked “Use regular expressions” check box and selected “Comments only”. In the “Look for:” text box I am trying to enter a regular expression which will find all the appropriate comments. The month and the date part works as I expected, but I cannot get it to show me comments with “08” year only.
>Here is my last attempt.
>^10|11|12(\/\d{1,2}\/)(08)$
>
>Please help.
>Thank you
>Yelena

Yelena,

(1) The ^ and $ say that the date must be EXACTLY between the beginning of the line and the end of the line, which is not the case

I'd say it will work without them. That is your problem

A couple of remarks

(2) Your are dealing with AND and OR.
10 is 1 and 2
| is OR
To be sure of the evaluation, I would put the alternation between ()
eg
(10)|(11)|(12)

(3) If ever you need ^ and $, put the expression between in ()
eg ^(my long expr)$
I have found - on occasions - that without the parens, it does not match where it should


Although your expression - without ^$ - works
10|11|12(\/\d{1,2}\/)(08)
I would prefer
((10)|(11)|(12))\/\d{1,2}\/08
or
(10|11|12)\/\d{1,2}\/08
update:

and I like this better - it will not match "0012/12/0800" but it will match "00 12/12/08 00" or "(12/12/08)"
\b1[012]\/\d{1,2}\/08\b
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform