Quark
✅ Regex to capture all attributes of html tag but it capture the last only.
i undersand but why the online regex can analyse the same line correctly ?
https://regex101.com/
choose .net
Pattern
<[\w.]+(?:\s+(\w+)\s*=\s*""[^""]*"")*\s*>
text : <SimBase.Document Type="MissionFile" version="1,0">
it can capture all attributes.
for me, this is not because the html is irregular and regex is regular,
regex can parse my text but if i use in a real code, it fail.
same with http://regexstorm.net/tester
Pattern : <[\w.]+(?:\s+(\w+)\s*=\s*\"[^\"]*\")*\s*/?>
27 replies
✅ Regex to capture all attributes of html tag but it capture the last only.
hi, thanx but i don't want use a library (i ask it ?).
my line to read is in SyncRoot var (read the picture).
i try to do that u see exactly . use a regex to capture all attributes in <tag >
@talk is cheap, show me the code
but, i need to identify the tag too to get his index and length in my line.
if i use your regex, when i have a lot of tag in same line or text + a tag, i can't know who is the good tag (position in text).
eg: blablabla <tag f="tt"> <tag j="klkll"> blabla
27 replies