#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)^@(.*?){(.*?),((.|\n)*?)+(}}|\n})+$"
Local $sString = "@inproceedings{martens2010deep," & @CRLF & _
"title={Deep learning via Hessian-free optimization}," & @CRLF & _
"author={Martens, James}," & @CRLF & _
"booktitle={Proceedings of the 27th International Conference on Machine Learning (ICML-10)}," & @CRLF & _
"pages={735--742}," & @CRLF & _
"year={2010}" & @CRLF & _
"}" & @CRLF & _
"@article-journal{AAA," & @CRLF & _
" url = {http://www.example.com}," & @CRLF & _
" year = {2016}," & @CRLF & _
" month = {}," & @CRLF & _
" publisher = {Elsevier}," & @CRLF & _
" journal = {{AAA Journal}}," & @CRLF & _
" author = {Austin Anderson and Austin Arnold}," & @CRLF & _
" title = {{Nothing To See Here}}," & @CRLF & _
"}" & @CRLF & _
"@article-journal{ZZZ," & @CRLF & _
" url = {http://www.example.com}," & @CRLF & _
" year = {2016}," & @CRLF & _
" month = {}," & @CRLF & _
" publisher = {Elsevier}," & @CRLF & _
" journal = {{ZZZ Journal}}," & @CRLF & _
" author = {Austin Zyzygy}," & @CRLF & _
" title = {{Moving On Up}}," & @CRLF & _
"}" & @CRLF & _
"@article-journal{InstMed2001," & @CRLF & _
" url = {http://www.ncbi.nlm.nih.gov/pubmed/25057539}," & @CRLF & _
" year = {2001}," & @CRLF & _
" month = {}," & @CRLF & _
" publisher = {{National Academy of Sciences}}," & @CRLF & _
" doi = {10.17226/10027}," & @CRLF & _
" volume = {}," & @CRLF & _
" number = {}," & @CRLF & _
" pages = {}," & @CRLF & _
" pmid = {25057539}," & @CRLF & _
" pmcid = {}," & @CRLF & _
" journal = {{}}," & @CRLF & _
" author = {{National Academy of Sciences}}," & @CRLF & _
" title = {{Crossing the Quality Chasm: A New Health System for the 21st Century}}," & @CRLF & _
"}" & @CRLF & _
"@article-journal{Wallace2013," & @CRLF & _
" url = {http://apt.rcpsych.org/content/19/4/250}," & @CRLF & _
" year = {2013}," & @CRLF & _
" month = {July}," & @CRLF & _
" publisher = {{Royal College of Psychiatrists}}," & @CRLF & _
" doi = {10.1192/apt.bp.112.010389}," & @CRLF & _
" volume = {19}," & @CRLF & _
" number = {4}," & @CRLF & _
" pages = {250-258}," & @CRLF & _
" journal = {{BJPsych Advances}}," & @CRLF & _
" author = {John Wallace}," & @CRLF & _
" title = {{Lost in translation: transferring knowledge from research to clinical practice}}," & @CRLF & _
"}" & @CRLF & _
"@article-journal{Glasziou2005," & @CRLF & _
" url = {http://ebn.bmj.com/content/8/2/36.full}," & @CRLF & _
" year = {2005}," & @CRLF & _
" month = {}," & @CRLF & _
" publisher = {{British Medical Journal}}," & @CRLF & _
" doi = {10.1136/ebn.8.2.36}," & @CRLF & _
" volume = {8}," & @CRLF & _
" number = {}," & @CRLF & _
" pages = {36-38}," & @CRLF & _
" journal = {{Evidence Based Nursing}}," & @CRLF & _
" author = {Paul Glasziou and Brian Haynes}," & @CRLF & _
" title = {{The paths from research to improved health outcomes}}," & @CRLF & _
"}" & @CRLF & _
"@article-journal{Glasziou2011," & @CRLF & _
" url = {http://pmj.bmj.com/content/early/2011/06/29/pgmj.2010.116012.full.html}," & @CRLF & _
" year = {2011}," & @CRLF & _
" month = {June}," & @CRLF & _
" publisher = {{British Medical Journal}}," & @CRLF & _
" doi = {10.1136/pgmj.2010.116012}," & @CRLF & _
" volume = {}," & @CRLF & _
" number = {}," & @CRLF & _
" pages = {}," & @CRLF & _
" pmid = {}," & @CRLF & _
" pmcid = {}," & @CRLF & _
" journal = {{Postgraduate Medicine Journal}}," & @CRLF & _
" author = {Sharon Mickan and Amanda Burls and Paul Glasziou}," & @CRLF & _
" title = {{Patterns of 'leakage' in the utilisation of clinical guidelines: a systematic review}}," & @CRLF & _
"}" & @CRLF & _
""
Local $sSubst = "{\"id\":\"${2}\",\"type\":${1},\"content\":[{${3}]}}"
Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst)
MsgBox($MB_SYSTEMMODAL, "Result", $sResult)
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm