How to match all characters after nth character with regex in JavaScript?

前端 未结 2 1646
一个人的身影
一个人的身影 2021-01-12 12:15

I want to match all characters after 8th character. And not include first 8!

I need exactly a regular expression cause a framework (Ace.js) requires a regexp, not

相关标签:
2条回答
  • 2021-01-12 12:34
    console.log("123456789".match(/^.{8}(.*)/)[1])
    
    0 讨论(0)
  • 2021-01-12 12:46
    (?<=^.{8}).* 
    

    will match everything after the 7th position. Matches 89 in 0123456789

    or IJKLM in ABCDEFGHIJKLM

    etc

    0 讨论(0)
提交回复
热议问题