regular expression in javascript

2008-04-24 8:39 pm
係javascript 用 regular expression , 點將 '/' 唔當做delimiter .
var pattern = new RegExp('m/\//');
if('/'.match(pattern))
document.write("ok");
else
document.write("not ok");


呢個永遠都print "not ok" . . .

回答 (1)

2008-04-29 8:16 pm
✔ 最佳答案
找到了一篇 javascript 教學是有關你的問題的, 主題是 Programmer's Guide to Regular Expressions, 內有提到 What is a regular expression? RegExp Syntax; 另外兩版的主題是 Regular Expression patterns; 及 Regular Expression methods and usage, 希望內裡的解釋對你有用:

http://www.javascriptkit.com/javatutors/redev.shtml

http://www.javascriptkit.com/javatutors/redev2.shtml

http://www.javascriptkit.com/javatutors/redev3.shtml


收錄日期: 2021-04-24 22:54:41
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20080424000051KK00791

檢視 Wayback Machine 備份