diff options
author | Teddy Wing | 2017-08-17 20:48:55 +0200 |
---|---|---|
committer | Teddy Wing | 2017-08-17 20:48:55 +0200 |
commit | ce5e3cf7fe71c5c508c7eaecfb2280b9346e792a (patch) | |
tree | ceddcc8784fb2b98d1332de10849cae5a61ae61d /src/Plugin.hs | |
parent | 3ee61aec34d6c652a485c3098d50ce4a15b542e7 (diff) | |
download | sorbot-ce5e3cf7fe71c5c508c7eaecfb2280b9346e792a.tar.bz2 |
gitRemoteSetOriginAction: Use regex capture group
Finally figured out how to get a capture group out of the regex match.
Needed to coerce as a two-dimensional `String` list.
Thanks to:
- https://stackoverflow.com/questions/24699279/cant-capture-a-group-in-a-string
- https://stackoverflow.com/questions/6729158/find-all-capturing-groups-of-a-regular-expression
Get the captured group and set it to the URL to insert into the
database. It lives in the second element of the first list:
Prelude Text.Regex.TDFA> "git remote set origin https://example.new" =~ "^git remote set origin ([^ ]+)$" :: [[String]]
[["git remote set origin https://example.new","https://example.new"]]
Prelude Text.Regex.TDFA> "" =~ "^git remote set origin ([^ ]+)$" :: [[String]]
[]
Diffstat (limited to 'src/Plugin.hs')
0 files changed, 0 insertions, 0 deletions