regex - Could anyone give an explain on following javascript RE code? -


could give explain on following example code? it's last example here.

not sure why there's no '\' before '.' , can same result adding '\'.

javascript:

var url = "http://xxx.domain.com"; print(/[^.]+/.exec(url)[0].substr(7)); // prints "xxx" 

note paragraph here regarding metacharacters inside character classes

note special characters or metacharacters inside character class closing bracket (]), backslash (\), caret (^) , hyphen (-). usual metacharacters normal characters inside character class, , not need escaped backslash.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -