Regex examples that are, as u see good

  • Thread starter Thread starter CY
  • Start date Start date
C

CY

Yes I know Google is your friend, but C# regex seach will get alot of
*shit*

Anyone just been trough this and got a link that helped, got VB6 and
C, some java behind in experiance.

read the nice msdn help but dont get the "aha" when I see a solution
on the net on how to find phone numbers or other examples.

So, just GIJF me if u want... I wont mind.

//CY
 
Yes I know Google is your friend, but C# regex seach will get alot of
*shit*

Anyone just been trough this and got a link that helped, got VB6 and
C, some java behind in experiance.

read the nice msdn help but dont get the "aha" when I see a solution
on the net on how to find phone numbers or other examples.

So, just GIJF me if u want... I wont mind.

....what is your question?
 
MY QUESTION:ANY pointers to a nice place for learning regex, that is/
was easy to get/understand/comprehend on the web? (Was that so
unclear?)

lets try this then

Jag skulle vilja hitta en sida med exempel på hur man enkelt fattar
regex i C#, MSDN är iofs trevlig, men ger inte den där aha upplevelsen
när man sen ser exempel på frågor/svar på nätet.
Jag misstänker att jag missar nåt enkelt, eller helt enkelt inte
ramlat över detta tidigare (kan det komma från *uix världen, där har
jag inte hållit till).

Finns massor av info på nätet, jag har kollat på en del av de 1 110
000 träffarna, men det som övergår mitt förstånd är när man sen skall
använda nåt för att filtrera ut delar av telefonnummer i seier eller
nåt så funkar det som sk*t. Sen hittar man en lösning som funkar till
99% men fattar inte ens hur.

//CY
 
To clarify again, I dont get

"(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)
*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-
\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-
z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9]
[0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-
z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-
\x09\x0b\x0c\x0e-\x7f])+)\])"

is following RFC2822, checking that an email address is correct, and
that example above is not foolproof either, as the author notes. is
there a simpler way to learn regex?

Opps, got to go to work...

//CY
 
CY said:
To clarify again, I dont get

"(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)
*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-
\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-
z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9]
[0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-
z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-
\x09\x0b\x0c\x0e-\x7f])+)\])"

is following RFC2822, checking that an email address is correct, and
that example above is not foolproof either, as the author notes. is
there a simpler way to learn regex?

Opps, got to go to work...

//CY

Well, noone gets that. At least not without sitting down and disect it
for half an hour or so...

The expression is trying to follow the standard for how an email address
may be constructed. The problem with using a regular expression like
that is that some users have email addresses that actually doesn't
follow all the rules of the standard, so you will disallow an email
address that is actually in use and is working fine (in most situations
at least).

Most regular expressions in use are a lot simpler. For example one that
checks that a string contains exactly one @ character, and that it's
neither the first nor the last character:

"^[^@]+@[^@]+$"

That can be used to check if a user entered something that might be an
email address, or entered something completely different. In some
situations a simple check like that is sufficient. No matter how
sofisticated the regular expression is, it still can't check if the
email adress actually exists.
 
MY QUESTION:ANY pointers to a nice place for learning regex, that is/
was easy to get/understand/comprehend on the web? (Was that so
unclear?)

If I had been forced to guess, then yes, I would have guessed that that was
your question. However, what you wrote above was TOTALLY clear. Why not just
be clear from the beginning? I'm sure every one of us who has been in
newsgroups for a long time has "barked up the wrong tree" at least once by
answering what we thought was the question being asked only to find out that
the original question was unclear. So we appreciate clarity.

By the way, have you been to http://www.regular-expressions.info? I learned
more there than anywhere.
 
By the way, have you been tohttp://www.regular-expressions.info?I learned
more there than anywhere.

Thanks Jeff, tried to be clear in the original question, but english/
american is not my first language and misstakes are made, a bit
grumpy, too 5 in the morning... . sorry for the caps.

For your Q, yes. Thats where I found the example on how it soon (the
link to this is on the startpage) got worse is just on
http://www.regular-expressions.info/email.html, nice start and then
wham slam... that is what I got... so I'll poke around that somewhat
more and see if I missed something.

Will dig on, its somewhere out there, might be on regular-
expressions.info.. lets see.

Thanks all.
 
Hello Cy,
MY QUESTION:ANY pointers to a nice place for learning regex, that is/
was easy to get/understand/comprehend on the web? (Was that so
unclear?)

lets try this then

Jag skulle vilja hitta en sida med exempel på hur man enkelt fattar
regex i C#, MSDN är iofs trevlig, men ger inte den där aha upplevelsen
när man sen ser exempel på frågor/svar på nätet.
Jag misstänker att jag missar nåt enkelt, eller helt enkelt inte
ramlat över detta tidigare (kan det komma från *uix världen, där har
jag inte hållit till).
Finns massor av info på nätet, jag har kollat på en del av de 1 110
000 träffarna, men det som övergår mitt förstånd är när man sen skall
använda nåt för att filtrera ut delar av telefonnummer i seier eller
nåt så funkar det som sk*t. Sen hittar man en lösning som funkar till
99% men fattar inte ens hur.

RegularExpression.info is pretty nice...

There's also a nice ebook on Regex in .NET by Dan Appleman
http://www.amazon.com/Regular-Expressions-NET-Dan-Appleman/dp/B0000632ZU

There's a super extensive book on any aspect of Regex. Mastering Regular
Expressions 3rd edition
http://regex.info/
 
Hello Cy,
Thanks Jeff, tried to be clear in the original question, but english/
american is not my first language and misstakes are made, a bit
grumpy, too 5 in the morning... . sorry for the caps.

For your Q, yes. Thats where I found the example on how it soon (the
link to this is on the startpage) got worse is just on
http://www.regular-expressions.info/email.html, nice start and then
wham slam... that is what I got... so I'll poke around that somewhat
more and see if I missed something.

Will dig on, its somewhere out there, might be on regular-
expressions.info.. lets see.

And should you ever be in The Netherlands, come look me up, I teach Regular
Expressions to my collegues at work :)
 
And should you ever be in The Netherlands, come look me up, I teach Regular
Expressions to my collegues at work :)

Thanks Jesse, that just what I need. (Not forgetting the rest of the
helping hands on this site)
And the invite was nice too, Netherlands isn't too far away from
Sweden (about 150 kilometers south of the arctic circle up north where
I'm at).
Learned to never say 15 miles and hoping all will understand, the hard
way ;) Didnt get that Americans drove 15 miles to a cinema... until it
hit me...

Tahnks all

//CY
 
Back
Top