0
let txt = "[email protected]"
let regex = NSRegularExpression(pattern: "([^@\\s]+)@test\\.(\\w+)", options:nil, error: nil)
let newString = regex!.stringByReplacingMatchesInString(txt, options: nil, range: NSMakeRange(0, count(txt)), withTemplate: "$1@baidu.$2")
println(newString)
0

不行遇到报错:

HTTP/2 client preface string missing or corrupt. Hex dump for received bytes:

Broadcast


JoyK
Better personal homepage
reddit style
GitHub Flavored Markdown syntax
Adaptive layout