|
In an XML document, how do I treat square brackets (] or [) ?
Started by Rahul Vyas on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Lt;/blah>
then again, so does (see Kirtan's answer):
<blah value="]"></blah>
Square brackets do not need a specific notation in XML but they have a special meaning when used in XPath.
|
|
I need to return just the text contained within square brackets in a string. I have the following regex, but this also returns the square brackets:
var matched = mystring.match("\\[.*]");
A string will only ever contain one set of square brackets, e.g...
Started by BrynJ on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
Rather that capture what is inside the brackets....
By the way, you probably don't want.
Did you try capturing parens:
("\[(.*)]");
This should return the pattern within the brackets to either use a capture group or trim off the brackets.
|
|
Var asdf = "a[3] > b[5] > c[1]" function removebracket(){ var newstring = asdf.replace(/\/[^\/]*$/, '') alert(newstring); } <a href="#" onClick="javascript:removebracket();"> remove square brackets one by one </a>
Started by gwegwegw on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
^ insideYour regular expression doesn't do ....
[^\/]
Everything between square brackets [] will match exactly one character.
This will remove square brackets:
var newstring = asdf.replace(/\[|\]/g, like / .
Parts from a path.
|
Ask your Facebook Friends
|
We have received some JavaScript from an agency that looks wrong, but works.
For some reason they are adding [square brackets] around variables, thus:
var some_variable = 'to=' + [other_variable];
This works, but the square brackets seem completely superfluous...
Started by Richard Ev on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
Var ar=new Array("a","b"); var ar=["a","b"];//Equal to the sintax above
in that situation there... .
As with any other use of the square bracket notation, the string within the brackets can be heldSquare brackets means new Array.
|
|
Are square brackets in URLs allowed?
I noticed that Apache commons HttpClient (3.0.1) throws an IOException, wget and Firefox however accept square brackets.
URL example: http://example.com/path/to/file[3].html
My HTTP client encounters such URLs but ...
Started by bene on
, 8 posts
by 8 people.
Answer Snippets (Read the full thread at stackoverflow):
Here's the relevant snippets:
The....
This is the only place where square bracket specification , the square brackets are not valid URL characters.
By enclosing the IP literal within square brackets ("[" and "]").
|
|
I have recently moved a database from Sql Server 2000 to Sql Server 2005. In the table designer, it insists on putting square brackets around a column named "Content" I don't see Content on the list of reserved words for Sql Server, so I don't understand...
Started by pthalacker on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Pamela.
The problem that is not named Content, the square brackets do not appear.
You can always add square brackets around a column name so it doesn't hurt anything.
|
|
Hello guys,
i'm currently trying to split a string in C# (latest .NET and Visual Studio 2008), in order to retrieve everything that's inside square brackets and discard the remaining text.
E.g.: "H1-receptor antagonist [HSA:3269] [PATH:hsa04080(3269)]...
Started by Hal on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Var pattern.
System.Text.RegularExpressions; // pattern = any number of arbitrary characters between square brackets.
|
|
I am having trouble figuring out the arguments to csv.dictreader and realized I have no clue what the square brackets signify.
From the docmentation:
class csv.DictReader(csvfile[, fieldnames=None[, restkey=None[, restval=None[, dialect='excel'[, *args...
Started by behindalens on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
I would think....
Usually in api documentation square brackets mean optional.
So arguments, see section 4.7.2 of the tutorial at python.org .
You can leave them out.
The square brackets indicate that these arguments are optional .
|
|
I came across this syntax while reading a script. I am not sure what is the use of square brackets.
push @data, [ split //, $line ]; #printing this array gives crap values
Or to put into other words what is the difference between the above and the following...
Started by shubster on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
The code:
push @data....
See also perldoc perlreftut.
Each element of @data is a reference to an anonymous array whose entries are the characters in $line .
That is from one of my answers :
push @data, [ split //, $line ];
@data is an array of array refs .
|
|
Hi,
I have seen a lot of C# programs that use the [], for example [STAThread] and then the code follows another classic example is [DLLImport].
I know what STATThread means but my question is what is the significance of the square brackets, essentially...
Started by Anand on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Some attributes have special meaning to the C# compiler, for instance the [Serializable] probably tells the compiler to... .
Attributes are a form of metadata that you can attach to various code elements: classes, methods, assemblies etc .
It's an attribute.
|