In: Computer Science
Regular expression translation
1. ^…$
in which ^ indicates start of the string and $ indicates end of the string. in between this two only three dots can possible can come
Example : ...
2. \<the\>
in which slashes are used to match < and >. In between these brackets the can only possible.
Example : <the>
3. ^[A-Z]..$
it will match any one character from A to Z and after that any two characters can possible, It may special characters, numbers, uppercase, lowercase etc..
Example
CcG
Q1R
Ri.
BA}
I>q
4. ^[A-Z][ a-z]*3[0-5]
means any one character from A to Z can set. After that, zero or more characters from a to z can be possible and 3 and then 1 character from 0 to 5.
Example : Basagsadbh35
5. [a-z]*\.$
In which any number of zero or more characters from a to z can be possible and \ is used to match . means after any number of characters there must be
.(dot). In short strings ends with .(dot)
Example : fhdjewvbafh.
6. ^ *[A-Z][a-z][a-z]$
means at space and * indicates any number of spaces can be possible. Then it will match 1 character from A to Z and then it will match 1 character from a to z and after that again it will match one character from a to z.
Example :
Bfg
Hyt
7. ^[A-Za-z]*[^,][A-Za-z]*$
Any characters from A to Z and a to z can be possible. [^,] means , can't possible and after that any number(zero or more) of characters from A to Z or a to z.
Example : sadjbsafjAdjfckdJGF
8. [[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}
[:digit:] any 3 characters from this set can be possible means [, ], :, d, g, i, t. And then .(dot) will come. then these will be repeating 3 times means any 3 characters from this set can be possible means [, ], :, d, g, i, t. And then .(dot) will come again any 3 characters from this set can be possible means [, ], :, d, g, i, t. And then .(dot) will come and again any 3 characters from this set can be possible means [, ], :, d, g, i, t. And then .(dot) will come.
Example :
d].[]]].t]]].g]]]
9. .*\([0-9][.][0-9]\)
.* menas strings can start with any chracter like special, uppercase, lowercase, digits etc.. \ is used to match opening bracket. After that ( (open bracket) will come and then any one digit from 0 to 9 will come then .(dot) and then again any digit from 0 to 9 can come. \ is used to match close bracket and ) will come at the end.
Example : !d5:7xwy(6.3)
10. [0-9]{3}-[0-9]{4}
In which any 3 characters from 0 to 0 will match then a -(hiphen) is possible. After that any 4 characters from 0 to 9 will be matched.
Example : 306-0552