Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

完成exercise7 #80

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/blink.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ var marked = require('marked')

module.exports = function (str) {
var md = marked(str)
// TODO
return null
// TODO 需要使用非贪婪模式,使用$[1-9]来代指匹配到的值
return md.replace(/@@([\w\W]+?)@@/g, `<blink>$1</blink>`)
}
2 changes: 2 additions & 0 deletions lib/capture.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module.exports = function (str) {
// TODO
const res = str.match(/(?<=x\=)\d+/)
return res ? res[0] : res
}
2 changes: 2 additions & 0 deletions lib/capture_breakword.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module.exports = function (str) {
// TODO
const res = str.match(/(?<=(\s|^)x\=)\d+((?=\s)|$)/)
return res ? res[0] : res
}
1 change: 1 addition & 0 deletions lib/quantified_group.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = function (str) {
// TODO
return /^(0x[\dA-F][\dA-F]\s*){8}$/i.test(str)
}
3 changes: 2 additions & 1 deletion lib/quotes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = function (str) {
// TODO
// TODO 使用非贪婪模式
return str.match(/"[\w\W]*?"/g)
}
286 changes: 286 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.