I have a text string that contain some references numbers like [3][2][4] or [1] or [5][7]
can you please help me removing all numbers between brackets ex. [4] from that string
using regular expressions Regex ?
Thanks
I have a text string that contain some references numbers like [3][2][4] or [1] or [5][7]
can you please help me removing all numbers between brackets ex. [4] from that string
using regular expressions Regex ?
Thanks
Just do a preg replace on /\[\d\]/
and replace it with ''
$s = preg_replace( '#\[\d+\]#', '', $context );
I believe that will kill multiple occurrences.
Since the question asks to remove numbers between the brackets and not the brackets themselves, I think this would be what he is looking for:
$string = preg_replace('/(?<=\[)\d+(?=\])/', '', $string);