Comment 4 for bug 1266879

Revision history for this message
Thomas Berezansky (tsbere) wrote :

To further limit it, for sanity purposes, we should not allow "leaving" the square brackets we are searching within. So something like this should prevent it from grabbing everything from the first square bracket to the end, hopefully only removing what we actually care about as a result:

note.value.replace('\[[^][@]*@[^][]*\]\s*$', '')

Given note.value of "This is a test [ some data ] more data [su 9/9/13 @ BR1]" we get different things with the different versions:

note.value.replace('\[.*@.*\]\s*', '') gives us "This is a test" - The same happens with the $ added, for the record.

note.value.replace('\[[^][@]*@[^][]*\]\s*$', '') gives us "This is a test [ some data ] more data"