javascript - js regular expression to get string
给我你的怀抱
给我你的怀抱 2017-05-19 10:10:44
0
3
588

If there is a string like this " www.com.baidu.com "
What I want to match is all the strings after the first com, but excluding " com ", how should I write the regular expression? ? That is to say, the desired string is ".baidu.com"
It is best not to match it by capturing groups;

给我你的怀抱
给我你的怀抱

reply all(3)
漂亮男人
var str = 'www.com.baidu.com'
var result = /.*?com(.*)/.exec(str)
console.log(result[1])
小葫芦

We are both newbies and have the same question.
I guess before the text is taken out, set an intermediate state to accept the string width of the text, subtract the first 3, and then assign it to the calling one.
(The above are all my guesses.)

曾经蜡笔没有小新
'www.com.baidu.com'.match(/.+\.com(.+)/)[1]
// ".baidu.com"

The regular diagram above:,

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template