-1

I want to find in search (in notepad++) all lines which have ParentId="x" in them

when i search for : OwnerUserId=".*" than it finds all lines which have OwnerUserId in them

so what is the reason when i search for "ParentId=".*" it does not find any line (or strangely sometimes it finds 1 line only) ?

breath
  • 1
  • 7
  • 1
    Does this answer your question? [How to find all "Parentid" quetsions that a single users posts are connected to?](https://stackoverflow.com/questions/74821074/how-to-find-all-parentid-quetsions-that-a-single-users-posts-are-connected-to) – Toto Dec 19 '22 at 10:40
  • No, that question you linked was also asked by me and also didnt get an answer – breath Dec 19 '22 at 11:34
  • [You can't parse xml with regex](https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454) – Toto Dec 19 '22 at 12:16
  • Can you explain that and how it realts to what i asked here ? i am using the search option in notepad++ and i found the owneruserid tag - so why doesnt it find the parentid tag ? i dont understand how your link is connected – breath Dec 19 '22 at 16:14
  • It shows you that **you can't** parse XML with regex. – Toto Dec 20 '22 at 13:15
  • Than what is the difference between OwnerUserId and ParentId in this context ? they are both in xml and with one it works , why is that ? – breath Dec 21 '22 at 06:29

1 Answers1

0

Ok , self answer , i have found another answer somewhere to a different case that recommends to use

(?s:.*?)

and i put it inside the search : ParentId="(?s:.*?)" and it works perfectly

, for someone like me who is not a programmer and that is not planing to use xml and regex etc except for one thing im trying to achive , it seems using regex with xml is a great option cause its fastest and easiest for me , even if its not "correct" not best option for others , it still is the best option for me

this is a link to where i found that answer :

Regular Expressions- Match Anything

Apperntly also : ParentId=".*?" (difference is the added question mark) works as well

Not sure why this things work though

breath
  • 1
  • 7