Ms7 Search
Google 搜尋 翻譯
calendar
« 十一月 2024 »
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30  
近期文章
文章分類
網站連結
Syndicate

« | »

javascript 用 regex 取出所要字串

2017-01-23 @ 19:10 in PHP, JavaScript, Sql

字串 abcd[0102] 想取出 0102

  1. 方法一:用 substr        var rc = "abcd[0102]".substr(5,4);
  2. 方法二:用 regex         var arr_rc = /^.*\[(\d+)\].*/.exec("abcd[0102]");        //取出符合我字串,第一個本身,第二個(),陣列從 0 開始
                                  var rc = arr_rc[1];
方法一固定從第六位取四位,0為第一位

方法二利用 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.

作者 web hosting services @ 07:02, 2020-07-22

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.

作者 best web hosting sites @ 11:03, 2020-07-23

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.

作者 cheap flights with jet2 holidays @ 11:09, 2020-07-28

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?

作者 flight search @ 14:28, 2020-07-29

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.

作者 cheap flights with jet2 com @ 10:35, 2020-07-31
發表迴響
 authimage