0
我現在正在撰寫一個使用正則表達式來解析模板的小項目,現在最大的問題是我們在這裏也得到了一個「標記」,這使得它很難。如何在標籤內的標籤上使用正則表達式?
Regex reg = new Regex(@"##############TEMPLATEENGINE(^#)##############(.*?)##############TEMPLATEENGINE(\1)##############", RegexOptions.IgnoreCase | RegexOptions.Compiled);
正常工作的模板一樣
######## TEMPLATEENGINE $$ startswith $$帳戶:名字$$ Firstn ############# #等等
######## TEMPLATEENGINE $$ startswith $$帳戶:名字$$ Firstn ######## TEMPLATEENGINEaccount:名字######### #####缺少屬性:名字! ############## TEMPLATEENGINEaccount:姓
但只要我有這樣
######## TEMPLATEENGINE $$ startswith $$模板賬號:名字$$ Firstn ##############等等
######## TEMPLATEENGINEaccount:名字############ ##缺少屬性:名字! ############## TEMPLATEENGINEaccount:firstname ######## TEMPLATEENGINE $$ startswith $$ account:firstname $$ Firstn ########### ###blahg
它只是發現內模板,雖然覺得\ 1應該確保開始和結束應該是平等的....
請問您能否提供詳細一點? –
「標籤內標籤」是什麼意思? – Amy