正则表达式的整理

Open
#2 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
25/100
Issue type
Documentation
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript
Domain
documentation

Research direction

The issue contains JavaScript RegExp notes covering methods, construction forms, and escaping user input. No file, test, or acceptance criteria is named, so first locate the intended study or documentation file and confirm the desired organization. Done should present the listed material coherently and accurately.

Written by the indexing model from the issue text.

Description

RegExp

exec
test

String

match
replace
search
split

定义方式:

var re = /ab+c/; expression literal

var re = new RegExp("ab+c");

字符串的转义成正则

有些转义用户输入被处理成含有一个正值表达式的字面字符串,这些输入可以被简单的替代值补充完整。

function escapeRegExp(string){
  return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
}
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lijiarui/nodejs-_study

All issues in lijiarui/nodejs-_study

Similar issues

More Documentation issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.