Hello,
Apart from what they are, I dont know anything about regular expressions... :(
I have this code in a javascript function:
var foroFormatting = function (text) {
var newText = text;
var findreps = [
{ find: /^([^\-]+) \- /g, rep: '<span class="ui-selectmenu-item-header">$1</span>' },
{ find: /([^\|><]+) \| /g, rep: '<span class="ui-selectmenu-item-content">$1</span>' },
{ find: /([^\|><\(\)]+) (\()/g, rep: '<span class="ui-selectmenu-item-content">$1</span>$2' },
{ find: /([^\|><\(\)]+)$/g, rep: '<span class="ui-selectmenu-item-content">$1</span>' },
{ find: /(\([^\|><]+\))$/g, rep: '<span class="ui-selectmenu-item-footer">$1</span>' }
];
for (var i in findreps) {
newText = newText.replace(findreps[i].find, findreps[i].rep);
}
return newText;
}
This code expect a string like this
John Doe - 78 West Main St Apt 3A | Bloomsburg, PA 12345 (footer text)
and split it in four span elements right?
I would like to apply the same formatting to a string that is a bit different from that
John Doe - 78 West Main St Apt 3A | Bloomsburg, PA 12345
How do I have to modify the regular expression?
EDIT
I am trying to use this plugin (third example) with a string of mine that is different from the original just in the last part