Regular expression to obtain all substrings of length n

后端 未结 1 1736
没有蜡笔的小新
没有蜡笔的小新 2021-01-22 17:45

Given an input string of only lower case letters and an integer N. I need a regular expression to extract all sub-strings of length N from the input st

相关标签:
1条回答
  • 2021-01-22 18:07

    You can use this lookahead regex to get all 3-character strings:

    (?=([a-z0-9]{3}))
    

    RegEx Demo

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