javascript 用 regex 取出所要字串
字串 abcd[0102] 想取出 0102
- 方法一:用 substr var rc = "abcd[0102]".substr(5,4);
- 方法二:用 regex var arr_rc = /^.*\[(\d+)\].*/.exec("abcd[0102]"); //取出符合我字串,第一個本身,第二個(),陣列從 0 開始
var rc = arr_rc[1];
方法二利用 partten 取出 [] 內的數字,不管前面有幾位都可以
迴響
javascript 用 regex 取出所要字串 | 豬窩
I know this if off topic but I'm looking into starting my own weblog and was wondering what all is needed to get setup?
I'm assuming having a blog like yours would cost a pretty penny?
I'm not very internet savvy so I'm not 100%
sure. Any recommendations or advice would be greatly appreciated.
Kudos
javascript 用 regex 取出所要字串 | 豬窩
My partner and I stumbled over here coming from a different website and thought I
may as well check things out. I like what I see so now i am following you.
Look forward to going over your web page repeatedly.
javascript 用 regex 取出所要字串 | 豬窩
You can definitely see your skills within the work you write.
The arena hopes for even more passionate writers such as you
who aren't afraid to mention how they believe. All the time follow your heart.
javascript 用 regex 取出所要字串 | 豬窩
Fantastic website you have here but I was curious about if you knew
of any discussion boards that cover the same topics talked about
here? I'd really like to be a part of community where I
can get comments from other knowledgeable people that share the same interest.
If you have any recommendations, please let me know.
Kudos!
javascript 用 regex 取出所要字串 | 豬窩
This is the right blog for anyone who hopes to
find out about this topic. You understand a whole lot its almost hard to argue with you (not that
I personally will need to…HaHa). You definitely put a brand new spin on a
topic that's been written about for years. Wonderful stuff, just wonderful!