Skip to content

Instantly share code, notes, and snippets.

@Haseeb-Qureshi
Created December 24, 2015 07:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Haseeb-Qureshi/b71e2554c0b99a5d294d to your computer and use it in GitHub Desktop.
Save Haseeb-Qureshi/b71e2554c0b99a5d294d to your computer and use it in GitHub Desktop.
test_string = <<-md
## Title1
*markdown1
## Title2
*markdown2
[link]: link
## Title3
markdown with # in it
md
puts test_string.scan(/(##[^#]+)/m)
@Haseeb-Qureshi
Copy link
Author

How do I capture each ##-delineated section separately, without cutting off everything after a single #?

Can't figure this out after a lot of Google searching. Tried negative lookahead groups but can't seem to figure out a working solution...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment