Regex Pattern: Start with X, contain Y, end with Z?
-
30-10-2019 - |
문제
I have a configuration file for an application I've made, and to load the configurations I need to parse them from the config file first. I'm kind of stuck.
Here is a snippet of the config file:
#0_downloaded_url:[http://example.com/to/be/downloaded/, http://example.com/to/be/downloaded/]
#0_follow_url:http://example.com/to/be/downloaded/
#0_download_url:http://example.com/to/be/downloaded/
#0_main_url:http://example.com/to/be/downloaded/
#1_downloaded_url:[http://example.com/to/be/downloaded/, http://example.com/to/be/downloaded/]
#1_follow_url:http://example.com/to/be/downloaded/
#1_download_url: http://example.com/to/be/downloaded/
#1_main_url:http://example.com/
I want to match everything that matches: #(digit)_(text and underscores):(anything)(linebreak), so basically one line at a time. I also wanna group the results, so I get the first digit, then the text after the digit, and at last the text (in this case a url) after the semicolon.
This is what I've come up with so far:
^#\d_\w*:.*
But that isn't what I want. It only matches one row, and it doesn't group the results.
올바른 솔루션이 없습니다
제휴하지 않습니다 StackOverflow