0
  1. Exactly what are regex?
  2. Do we write them ourselves or are they prdefined expressions?
  3. If we can write regex ourselves, how do we write them?
  4. How do they check for invadalities?

For example the email regex:

[-0-9a-zA-Z.+_]+@[-0-9a-zA-Z.+_]+\.[a-zA-Z]{2,4}

how does this expression check for valid email addresses?

I have tried to look for simple explanations on the web but have found nothing confusing stuff.

Thankyou!

2
Contributors
1
Reply
16
Views
3 Years
Discussion Span
Last Post by pritaeas
0

Exactly what are regex?

Patterns for testing against input strings.

Do we write them ourselves or are they prdefined expressions?

You write them, but there are many examples readily available.

If we can write regex ourselves, how do we write them?

Text editor or tool.

how does this expression check for valid email addresses?

Besides the fact that it's flawed:

[-0-9a-zA-Z.+_]+

1 or more characters within the []

\.

A dot.

[a-zA-Z]{2,4}

2, 3 or 4 characters within the [].

I have tried to look for simple explanations on the web but have found nothing confusing stuff.

http://www.regular-expressions.info

Edited by pritaeas

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.