Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I am trying to do some work in an application action that is written based on the javascript language but seem having a problem trying to strip the following chars '[' and ']' from a string.
Basically a string such as one of the following 4 examples will be passed:Code: Select all
f[sometext]
f['sometext']
$f[sometext]
$f['sometext']Code: Select all
mySelectName = mySelectName.replace( new RegExp( "'", "gi" ), "" );
mySelectName = mySelectName.replace( new RegExp( "f[", "gi" ), "" );
mySelectName = mySelectName.replace( new RegExp( "]", "gi" ), "" );
Code: Select all
mySelectName = mySelectName.replace(/f[/gi, "")
mySelectName = mySelectName.replace(/]/gi, "")
Code: Select all
mySelectName = mySelectName.replace("'", "")
mySelectName = mySelectName.replace("f//[", "")
mySelectName = mySelectName.replace("//]", "")
Anyone any ideas on how to strip these chars without getting an error?
Thanks
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
[quote="[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1"][b]1.[/b] Select the correct board for your query. Take some time to read the guidelines in the sticky topic.[/quote]