I have a textarea
filled with some content.
Something like this:
Some line of text [185047078]1x some more text of - Type 1
[185047138]1x some other text of - Type 2
What I'm trying to do is to strip all text except [185047078]
and [185047138]
. I want to create an array later on with that data.
Since the data between the brackets is dynamically and also the textarea can have 20 more lines of text I'm looking to create a logical way of stripping this textarea.
But I'm not sure what would be the way to start to strip this textarea. Since you can't search or something to search in the textarea the only option is too strip all text?
But I have no idea on how to start.
What I tried is:
var txt = $(this).text()
txt = txt.match(/\d/g).join('')
txt = txt.replace(/\D/g,'');
txt = txt.replace(/&\/\\#,+()$~%.'":*?<>{}/g, '');
What is the correct syntax to strip this textarea so I'll end up with [185047078]
and [185047138]
?