-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d2015b
commit d3716c1
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# regex-engine | ||
## Introduction | ||
A regular expression (shortened as regex or regexp) is a sequence of characters that specifies a search pattern. Regular expressions are extremely useful in | ||
extracting information from any text by searching for one or more matches of a specific search pattern | ||
(i.e. a specific sequence of ASCII or unicode characters).Usually such patterns are used by string-searching algorithms for | ||
"find" or "find and replace" operations on strings, or for input validation. | ||
|
||
It is a technique developed in theoretical computer science and formal language theory. | ||
Fields of application range from validation to parsing/replacing strings, passing through translating data to other formats and web scraping. | ||
|
||
## Operations supported | ||
* greedy and non-greedy | ||
* Support the following macros | ||
* [] | ||
* a-z | ||
* A-Z | ||
* 0-9 | ||
* Individual characters and numbers | ||
* ^ | ||
* $ | ||
* . | ||
* ? | ||
* \+ | ||
* \* | ||
* \d | ||
* \w | ||
* \s | ||
* escape characters | ||
|
||
## Function/Interface supported | ||
match is the only function supported for the client as an interface. all other functions are not available to the client, they are implementation functions | ||
(internal static functions) | ||
### match | ||
```c | ||
node_t *match(char *pat, char *text); | ||
``` | ||
it returns starting and ending position of the string if the substring of text matches with the pattern else returns null. | ||
## Usage | ||
``` | ||
$ make | ||
$ ./output | ||
``` |