Regular Expressions Part 02

Hi all, from a previous post we talked about regular expressions and get a basic idea about regular expressions. From this post I’m going to look into more about regular expressions.

  • we can use the | to do a selection between multiple criteria. All of them will be chosen as correct results.

100

  • we can use previously known \b with this | symbol to check only for exact words.

101

  • ? is having a special meaning where it will be used to make the expression optional.

105
103

  • We can use ?? to make first one disable.

106

  • Also we can use | symbol with the ?. Also here I have used () for grouping.

104

  • {,} is used to show a repetition limit. First number is the starting point and the second number is the finish point.

107

  • \1 is the back reference for the capture group one which is grouped by first pair of (). we can reuse the back reference as well.

110.png

  • \2 shows the back reference for the second group.

111.png

  • We can use what we have learnt up to now to check repeating words.

Screenshot from 2016-07-14 09:46:37

  • We can create a non capturing group as well. These groups will not be captured in backtracking.

112.png

So I hope now you have a clear idea about regular expressions. See you soon with another post for regular expressions. Thank You!

Advertisements

One thought on “Regular Expressions Part 02

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s