Hi, I have a CDATA example here
<![CDATA[asd[f]]]>
and
<tag1><![CDATA[asd[f]]]></tag1><tag2><![CDATA[asd[f]]]></tag2>
CDATA regular expression cannot recognize this
"<![CDATA["([^\]]|"]"[^\]]|"]]"[^>])*"]]>"
it doesn't work either
"<![CDATA["[^\]]*[\]]{2,}([^\]>][^\]]*[\]]{2,})*">"
Someone please give me a regex for <![CDATA[asd[f]]]>I need to use it in Lex / Flex
: I answered this question, please vote for my answer, thanks.
This is the solution. The reason that we need to use the START STATE, - is that ever between <!CDATA[and ]]>did not get a match with another REGEX.
<!CDATA[
]]>
%option noyywrap %x CDATA %% "<![CDATA[" { BEGIN CDATA; printf("Entering CDATA\n"); } <CDATA>([^\]]|\n)*|. { printf("In CDATA: %s\n", yytext); } <CDATA>"]]>" { printf("End of CDATA\n"); BEGIN INITIAL; } %% main() { yylex(); }
Easy enough, it should be like this:
<!\[CDATA\[.*?\]\]>
At least he works at regexpal.com
, , lex; , ERE, :
lex
<!\[CDATA\[(.*?)\]\]>
<!\[CDATA\[((?:[^]]|\](?!\]>))*)\]\]>
( , . , , , .)
, , , , C lex, , CDATA ( <![CDATA[), , ]]>, . ( , , flex lex ), , .
<![CDATA[
flex
, , , , ], ]>. , ( !) , .
]
]>
, SO , HTML .NET.
CDATA .
CHAD:
:
asd[f]
FlexRegEx .
One note - searching for CDATA should also exclude comments; CDATA can be embedded./<!(?:\[CDATA\[(.*?)\]\]|--.*?--|\[[A-Z][A-Z\ ]*\[.*?\]\])>/sgThis can be done by checking if group 1 is valid for each match returned in the global search.
/<!(?:\[CDATA\[(.*?)\]\]|--.*?--|\[[A-Z][A-Z\ ]*\[.*?\]\])>/sg
<!\[CDATA\[\s*(?:.(?<!\]\]>)\s*)*\]\]>
Previuos answer just changed
Source: https://habr.com/ru/post/1783885/More articles:How do you free an XMLHttpRequest object and how do you free an ActiveXObject ("Microsoft.XMLHTTP")? - javascriptssh gave me permission denied! - githubJList with custom renderer - javaLinearLayout image alignment by code - javaNesting Razor Views in a Class Library as Resources - asp.net-mvcΠΠ½Π°ΡΠ΅Π½ΠΈΠ΅ 'How to remove data from a specific business day from the time series R? - rto find duplicate series in SQL - duplicateshttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1783889/pyqt4-need-to-move-dlls-to-package-root&usg=ALkJrhipysAuKwWMKWhBpJvuXwHkvZvFcgUsing Qt Creator (with Qwt), really basic stuff - qtAll Articles