|
I want to extract information from user-inputted text. Imagine I input the following:
SetVariables "a" "b" "c"
How would I extract information between the first set of quotations? Then the second? Then the third?
Started by Reznor on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Gt;>> import re >>> re.findall('"([^"]*)"', 'SetVariables "a" "b" "c" '); ['a', 'b', 'c']
Regular expressions are good at this:
import re quoted = re.compile(r'"[^"]*"') for value in quoted.findall(userInputtedText): print value
You ... .
|
|
Here is my code snippet:
Public Function convert(ByVal robert As String) Try robert = Replace(robert, "U", "A") robert = Replace(robert, "\"", "A")
I want to actually replace the "quotations" with the A but the program doesn't seem to recognize the fact...
Started by Robert on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
See http://www.codingforums.com/archive/index.php/t-20709.html
you want to use:
robert = Replace....
So it would be
robert = Replace(robert, """", "A")
Looks like VB, not c++ .
In VB (which is what the code sample is in), the escape character is double quotes .
|
|
I'm looking for a SimpleGrepSedPerlOrPythonOneLiner that outputs all quotations in a text.
Example 1:
echo “HAL,” noted Frank, “said that everything was going extremely well.” | SimpleGrepSedPerlOrPythonOneLiner
stdout:
"HAL," "said that everything was...
Started by secr on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
No regexp solution will work if you have nested quotes, but for your examples this works well
$... .
Grep -o "\"[^\"]*\""
This greps for " + anything except a quote, any number of times + "
The -o makes it only output the matched text, not the whole line .
|
Ask your Facebook Friends
|
I'm parsing a xml file and inserting it into database. However since some text containes double or single quotation I'm having problem with insertion. Currently I'm using the code shown below. But it seems it's inefficient.
s = s.replace('"', ' ') s =...
Started by ablimit on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Why can't you insert strings containing quote marks into your database? Is there some weird data type that permits any character except a quote mark? Or are you building an insert statement with literal strings, rather than binding your strings to query... .
|
|
I have a text title that reads
This User "The Title Of The Post"
I want to grab just whats INSIDE of the quotation marks, and store it in a variable. How would i do this with regex and php?
Started by Patrick on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Http://www.php.net/preg%5Fmatch
<?php $x = 'This User "The Title Of The Post"'; preg_match('/".*?"/', $x, $matches); print_r($matches); /* Output: Array ( [0] => "The Title Of The Post" ) */ ?>
<?php $string = 'This User "The Title Of The... .
|
|
When quoting
<@ 1 + 1 @>
I want "1 + 1"
instead of
"Call (None, Int32 op_Addition[Int32,Int32,Int32](Int32, Int32), [Value (1), Value (1)])"
Started by ais on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
There is none, and it's not quite that easy, except in very .
See the F# quotations visualizer code as a guide for transforming the quotations abstract syntax tree.
You'll have to write it yourself.
|
|
I'm starting to write a code syntax highlighter in JavaScript, and I want to highlight text that is in quotes (both "s and 's) in a certain color. I need it be able to not be messed up by one of one type of quote being in the middle of a pair of the other...
Started by The.Anti.9 on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
It's a huge topic and you'll find that you'll come upon bigger problems than parsing strings .
For your problem, you could read up on parsing (and lexers) at Wikipedia .
Unless you're doing this for the challenge, have a look at Google Code Prettify .
|
|
Alright, I have a script that takes a few arguments, runs data, and then rsyncs the data out to a different server. The problem is that to run the data, I have to take one of the arguments and then run a report using it, which is very bash unfriendly ...
Started by Dropped.on.Japan on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Use single quotes around the value when you set it, then use double-quotes around the variable when you expand it:
$ arg1='[5111.3$]="5"' $ echo "$arg1" [... .
Try
[5111.3$]=\"5\"
The Advanced Scripting Guide has a good section on quoting .
Quote escapes.
|
|
Posted 03 October 2004 - 01:23 PM
Do you know any famous (or not so famous) medieval quotations? Post them here!
Edited by Ricker, 10 January 2007 - 08:55 PM.
Started by Ricker on
, 20 posts
by 7 people.
Answer Snippets (Read the full thread at shadowedrealm):
Posted 06 November 2004 - 01:01 PM
Here's a limerick I found rumoured to be by Chaucer:
Ther once was this ladye of Tyre
Whoo fild evry mann with deesiyre
Two sovrins enuff
For youre back setey stuf
But fees for onne nite are much hyer
Has anyone else... .
|
|
Quotations by famous persons litter the internet like debris strewn along a beach after a airplane crash.
Do you see what I did there? Yes, I'm sure you do. And now I propose that you follow suit. Place your quotation inside "quotation" marks so others...
Started by Isaacdeath on
, 33 posts
by 15 people.
Answer Snippets (Read the full thread at skepticforum):
What makes, and the rest of us are in great danger ... .
Try again.
I'm sure you can cobble together one or more about death or PayPal .
I'm sure you can cobble quotations.
But, this thread is for your own , original, pithy quotations.
Howie.
|