How to regex part of string but not whole?

74 views
Skip to first unread message

Mat

unread,
Feb 15, 2020, 3:31:55 PM2/15/20
to TiddlyWiki
How should I formulate the operand for the regexp filter operator ( regexp[...] ) to catch
<div
but not
<div>
nor (for example)
<div class="x">
?

I'm hoping there is a single regexpression for this.

<:-)

TiddlyTweeter

unread,
Feb 16, 2020, 7:59:25 AM2/16/20
to TiddlyWiki
Ciao Mat

What you interested in here is negatives? Right?

You will have to do the regex through a definition since negatives involve square brackets.

"<div ?[^c>]" should work for the example. If its the content of a one line field. IF its deep inside a text field we'd need to do a bit more.

But basically ...

literal "<div"
" ?" match  0 or 1 space
"[^c>]" match any character that is not "c" or ">" 

 This should match anything NOT with those patterns.

Tell me if you have problems.

TT

Mat

unread,
Feb 16, 2020, 5:39:57 PM2/16/20
to TiddlyWiki
Thank you TT - you're just the man I hoped would reply! May I invite you to my secret project which is soon to be unleashed onto the community? I strongly suspect it will be a hit(!) and it does need a few regexp's. I don't want to post about it here prematurely so anyone dismisses it.

<:-)
Reply all
Reply to author
Forward
0 new messages