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 取出所要字串 | 豬窩

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

作者 tinyurl.com @ 16:22, 2020-06-26

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.

作者 cbd oil that works 2020 @ 05:28, 2020-06-29

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.

作者 cbd oil that works 2020 @ 06:47, 2020-06-29

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!

作者 best hosting @ 11:11, 2020-07-18

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!

作者 web hosting providers @ 12:13, 2020-07-18
發表迴響
 authimage