You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to compare the difference between rich text and plain text and get each char's index in rich text. As the pic show ,HTML tags can affect the comparison results. so How could I set a regex such as /<(\S{1,}?)[^>]*>|<\/\1>/gms to ignore these tags but keep their positions in the string or treat HTML tags as a whole ?
The text was updated successfully, but these errors were encountered:
Sounds like you'd maybe want to write your own tokenizer (maybe treating each tag, attribute, or text node as a token), tokenize the strings you're comparing to diffArrays? I'm not 100% sure I understand what you want to achieve from the description but I suspect it could be done with a custom tokenizer as described in the second paragraph of Defining custom diffing behaviors.
I want to compare the difference between rich text and plain text and get each char's index in rich text. As the pic show ,HTML tags can affect the comparison results. so How could I set a regex such as

/<(\S{1,}?)[^>]*>|<\/\1>/gms
to ignore these tags but keep their positions in the string or treat HTML tags as a whole ?The text was updated successfully, but these errors were encountered: