Reputation: 857
I have the following snippet of text:
@article{carr2006,
title={Techniques for qualitative and quantitative measurement of aspects of laser-induced damage important for laser beam propagation},
author={Carr, CW and Feit, MD and Nostrand, MC and Adams, JJ},
journal={Meas. Sci. Technol.},
volume={17},
number={7},
pages={1958},
year={2006},
publisher={IOP Publishing}
}
@article{NIF1998,
author = {Schwartz, Sheldon and Feit, Michael D. and Kozlowski, Mark R. and Mouser, Ron P.},
title = {Current 3-ω large optic test procedures and data analysis for the quality assurance of National Ignition Facility optics},
journal = {Proc. SPIE},
volume = {3578},
number = {},
pages = {314-321},
year = {1999},
}
And I've been trying to extract the article by it's tag, however I fail to understand how the greedy/non-greedy works, or rather how to capture everything in the brackets when it contains more brackets :/
The following regexp returns a result up until first brackets, which is not what I'm aiming for...
/\{(carr2006[^}]+)\}?/s
Also was trying to capture full text with @article in front, but that doesn't work either...
/@*\{(carr2006[^}]+)\}?/s
Any explanations on what I'm doing wrong would be helpful :)
Upvotes: 0
Views: 41
Reputation: 174696
You may change your regex like below.
@\w+\{1st_standard(?:,\s*\w+\s*=\s*(?:{[^}]*}|"[^"]*"))+,?\s*\}
\s*
should match any type of whitespace character so this would match also the line breaks.
Upvotes: 1