Regex - Matching text AFTER certain characters

后端 未结 4 1465
梦如初夏
梦如初夏 2020-12-19 01:15

I want to scrape data from some text and dump it into an array. Consider the following text as example data:

| Example Data
| Title: This is a sample title
|         


        
4条回答
  •  执念已碎
    2020-12-19 01:42

    I know you are asking for regex but I just saw the regex solution and found that it is rather hard to read for those unfamiliar with regex.

    I'm also using Ruby and I decided to do it with:

    line_as_string.split(": ")[-1]
    

    This does what you require and IMHO it's far more readable. For a very long string it might be inefficient. But not for this purpose.

提交回复
热议问题