moodymudskipper / unglue

Extract matched substrings using a pattern, similar to what package glue does in reverse
GNU General Public License v3.0
159 stars 2 forks source link

Make all separators work #1

Closed moodymudskipper closed 5 years ago

moodymudskipper commented 5 years ago

now "{" and "}" are hardcoded in some places

moodymudskipper commented 5 years ago

done :

library(unglue)
sentences <- c("666 is [a number]", "foo is [a word]",
               "42 is [the answer]", "Area 51 is [unmatched]")
patterns <- c("<number=\\d+> is [<what>]", "<word=\\D+> is [<what>]")
unglue_data(sentences, patterns,open = "<", close = ">")
#>    number       what word
#> 1     666   a number <NA>
#> 2      NA     a word  foo
#> 3      42 the answer <NA>
#> 11     NA       <NA> <NA>

Created on 2019-07-15 by the reprex package (v0.3.0)

github-actions[bot] commented 2 years ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.