You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Because of the JavaScript regex engine, there is something different from [Simple Regex](https://simple-regex.com/)
10
-
-NOT support `as` to assign capture name.
10
+
-Support `as` to assign capture name with CODE but not regex engine.
11
11
- NOT support `if already had/if not already had`
12
12
- NO `first match` and NO `all lazy`, since in JavaScript `lazy` means non-greedy (matching the fewest possible characters).
13
13
@@ -46,10 +46,45 @@ Using [Webpack](http://webpack.github.io) and [babel-loader](https://github.com/
46
46
In SRL-JavaScript we apply `g` flag as default to follow the [Simple Regex](https://simple-regex.com/) "standard", so we provide more API to use regex conveniently.
47
47
48
48
-`isMatching` - Validate if the expression matches the given string.
49
+
50
+
```js
51
+
const query = new SRL('starts with letter twice')
52
+
query.isMatching(' aa') // false
53
+
query.isMatching('bbb') // true
54
+
```
55
+
49
56
-`getMatch` - Get first match of the given string, like run `regex.exec` once.
57
+
58
+
```js
59
+
constquery=newSRL('capture (letter twice) as word whitespace')
60
+
61
+
query.getMatch('aa bb cc dd') // [ 'aa ', 'aa', index: 0, input: 'aa bb cc dd', word: 'aa' ]
62
+
```
63
+
50
64
-`getMatches`- Get all matches of the given string, like a loop to run `regex.exec`.
65
+
66
+
```js
67
+
const query = new SRL('capture (letter twice) as word whitespace')
0 commit comments