Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Regular Expressions or (Hey Microsoft RegEx standards)
Message
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Regular Expressions or (Hey Microsoft RegEx standards)
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Divers
Thread ID:
01101609
Message ID:
01101609
Vues:
52
OK, Gang this is an issue I may be over complicating. Is anyone else using regex in the following manner in .NET not perl?

Say I have a string such as "www.MyCoolSite.Com" and I need domain parts I would use a regex as follows "(www\.)(.*)(\.com)" or "{www\.}{.*}{\.com}" and I can format the output as "Part 2: $2 Part 1: $1 Part 3: $3" or "Part\ 2\:\ \2 Part\ 1\:\ \1 Part\ 3\:\ \3" returning a result of "Part 2: MyCoolSite Part 1: www. Part 3: .com"

My real question lies at the ors above... Is there some rhyme or reason as to when to use the proper \1 vs. $1 and also the {} vs. () ... I have not really seen the consistancy I would hope for. Seems like asp.net code behind in vb.net seems to want the paren and dollar combo but in winform vb.net the slashes are good. Whats up with the inconsistancy.

My very humble thanks in advance,
~Joe Johnston USA

"If ye love wealth better than liberty, the tranquility of servitude better than the animated contest of freedom, go home from us in peace. We ask not your counsel or arms. Crouch down and lick the hands which feed you. May your chains set lightly upon you, and may posterity forget that ye were our countrymen."
~Samuel Adams

Répondre
Fil
Voir

Click here to load this message in the networking platform