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 取出所要字串 | 豬窩
Hi everyone, it's my first go to see at this web site, and paragraph is actually fruitful designed for
me, keep up posting such content.
javascript 用 regex 取出所要字串 | 豬窩
Hi there every one, here every person is sharing
such knowledge, thus it's good to read this weblog, and I
used to pay a quick visit this weblog every day.
javascript 用 regex 取出所要字串 | 豬窩
Have you ever thought about publishing an e-book or
guest authoring on other sites? I have a blog based on the same topics you discuss and would really like to have you share some stories/information. I know my audience would value your work.
If you're even remotely interested, feel free to shoot me an email.
javascript 用 regex 取出所要字串 | 豬窩
excellent issues altogether, you just gained a emblem new
reader. What might you recommend in regards to your post that you made a few days ago?
Any certain?
javascript 用 regex 取出所要字串 | 豬窩
I've been browsing online more than 4 hours today, yet I never found
any interesting article like yours. It's pretty worth enough for me.
In my view, if all website owners and bloggers made good content as you
did, the net will be a lot more useful than ever before.