Regular Expression :
>> Meaning of Special character [](){}|?+-*^$\
[] => Square brackets can be used to define a character group. [abc] The example finds one of the characters a, b or c.
- => The hyphen can be used to define a range of characters. [a-f] The example finds one of the characters a, b, c, d, e or f. Also in this example, the regular expression only matches one character.
^ => With the meta character ^ at the beginning of a character group, the character group is negated. That means, the example will match any character but not an a. [^a]
^a If the meta character ^ is not included into a character group, it stands for the beginning of a string or a line. The example would match all lines or strings beginning with a.
$ => a$ Like the meta character ^ stands for the beginning of a string or a line, the character $ stands for its end. The example would match all strings or lines ending with an a.
^abc$ Here the meta characters ^ and $ are used together. This example would match all strings or lines which are equal to "abc".
Example 1: abc
Example 2: abc abc
No comments:
Post a Comment