I try-I try, I just can’t make friends with regular expressions:
var str = "ONE=lorem-one-1; TWO=lorem-two-2; THREE=loremthree" you need to pull out TWO=lorem-two-2 , and the necessary part can be either in front, in the middle or at the end, the text also has exactly this format ( текст_или_цифры-текст_или_цифры-цифры ) .. preferably I would like to pull it out in groups .. текст_или_цифры-текст_или_цифры-цифры this:
str.match('TWO=(\w\d)-(\w\d)-(\d);?')
but all without success
String.prototype.split()does not solve your problem? It will split your string into an array with three elements, if passed as an argument;(with a space). Then you can simply refer to the second element of the array or search through each element in search of the necessary one. - neluzhin