parsing

Parsing a Gmail-style advanced search syntax?

I want to parse a search string similar to that provided by Gmail using Perl. An example input would be "tag:thing by:{user1 user2} {-tag:a by:user3}". I want to put it into a tree structure, such as {and => [ "tag:thing", {or => [ "by:user1", "by:user2", ]}, {or => [ {not => "tag:a"}, "by:use...

Is HtmlCleaner thread safe?

I can't find an answer on their website. Do you have any idea if HtmlCleaner is thread safe or not? I have a multiple threads that need to use it but I don't know if I can safetly reuse an instance of the HtmlCleaner object. Have you ever used it? any idea? ...

Html Parser & Object Model for .net/C#

Hi, I'm looking to parse html using .net for the purposes of testing or asserting its content. i.e. HtmlDocument doc = GetDocument("some html") List forms = doc.Forms() Link link = doc.GetLinkByText("New Customer") the idea is to allow people to write tests in c# similar to how they do in webrat (ruby). i.e. visits('\') fills_in "...

Is there a library which handles the parsing of BIND zone files in Python?

Hi, This is related to a similar question about BIND, but in this case I'm trying to see if there's any easy way to parse various zone files into a dictionary, list, or some other manageable data structure, with the final goal being committing the data to a database. I'm using BIND 8.4.7 and Python 2.4. I may be able to convince manag...

Help with regexp to extract values from inside brackets

I would like to get a regexp that will extract out the following. I have a regexp to validate it (I pieced it together, so it may not be the the best or most efficient). some.text_here:[12,34],[56,78] The portion before the colon can include a period or underline. The bracketed numbers after the colon are coordinates [x1,y1],[x2,y2].....

Find with php specific parameters in XML

Hello i have the follow problem. I have e XML file and i know the value of "uniquename=value2". I want extract the value of URL. <set uniquename="value1"> <items> <item> <units> ... </units> </item> <item> <units> ... <url>http://www.something&lt;/url&gt; ... </unit...

working with string arrays in c++

I wanna create a list of 50 elements which consist of four chars each. Every four char string should go into a loop one by one and get checked for one of three letters (o, a, e) anywhere in the current string. dependent on whether or not these letters are identified different commands are executed I tried all day im frustrated please he...

Parsing HTTP data into PHP variables

I have a reasonably large number of variables encoded in the form: foo=bar&spam[eggs]=delicious&... These are all in a single string (eg, $data = "foo=bar&spam[eggs]=delicious&..."). The variables are arbitrarily deeply nested -- easily four or five levels deep ("spam[eggs][bloody][vikings]=loud"). Is there an easy, reliable way to ...

Regular expression library that returns all matches for multiple patterns in one run for C++?

I'm looking for a regular expression (or something else) library for C++ that would allow me to specify a number of patterns, run on a string and return the matching locations of all patterns. For example: Patterns {"abcd", "abcd"} String {"abcd abce abcd"} Result: abcd matches: 0-3, 11-14 abce matches: 5-9 Anyone know of a such a lib...

java.io.StreamTokenizer.TT_NUMBER: Floating or Integer ?

Hi all is there a way to find if the value parsed and returned by java.io.StreamTokenizer.nval (e.g. 200) was an integer or a floating number ? Thanks Edited: I want to be able to know if the input was '200' or '200.0'. ...

a CSS class for Java

I'm about creating a java class for parsing and storing the content of a simple CSS stylesheet. This class will be used to paint a non-html object using the CSS selectors. My naive approach is to basically use a Map<String,Map<String,Object>> to store this stylesheet. Would it be any (clever) other way for storing this information ? ...

C#: How to import SQL-script into database programmatically?

Do I have to parse the SQL-script manually and execute each statement separately or are there better ways? Iam looking for a programmatically solution, I know there are tools which are already able to do this. It would be good if the solution would work for all database systems, not just sqlite. ...

How to parse a URL in C?

Hi, Im wondering how to parse a url into an URL object(of some kind) in C. So that I would be able to extract key/val objects from a querystring. Have looked at: http://stackoverflow.com/questions/726122/best-ways-of-parsing-a-url-using-c And several other resources, even Google Code, but haven't found anything in my taste.. And no, u...

Parsing XML in PHP

<?php $xmlstr = <<<XML <books> <book> <title>Great American Novel</title> <plot> Cliff meets Lovely Woman. </plot> <success type="bestseller">4</success> <success type="bookclubs">9</success> </book> <book> <title>Man Bites Dog</title> <plot> Reporter invents a prize-wi...

Parsing JSON from PHP

Hi, I'm trying to iterate in a JSON object that is returned from a PHP script. The return part is something like: $json = array("result" => -1, "errors" => array( "error1" => array("name" => "email","value" => "err1"), "error2" => array("name" => "pass","value" => "err2") ) ); $encoded = json_encode($json...

Cleanest way to parse this pattern of strings?

I have music file names like: Gorillaz (2001) Gorillaz (7th State Mix) (2002) Gorillaz (2001) (Featuring Travis) Gorillaz (1Mix) (2003) Gorillaz (1000) (2001) How do I parse the year in the cleanest, easiest way? Right now I am parsing them by finding each '(' and then making sure the character count between the ()s are 4 and first c...

Extract filename and path from URL in bash script

In my bash script I need to extract just the path from the given URL. For example, from the variable containing string: http://login:[email protected]/one/more/dir/file.exe?a=sth&amp;b=sth I want to extract to some other variable only the: /one/more/dir/file.exe part. Of course login, password, filename and parameters are optional...

What is an efficient way to parse a String in Java?

How should I parse the following String using Java to extract the file path? ? stands for any number of random charaters _ stands for any number of white spaces (no new line) ?[LoadFile]_file_=_"foo/bar/baz.xml"? Example: 10:52:21.212 [LoadFile] file = "foo/bar/baz.xml" should extract foo/bar/baz.xml ...

Parsing Custom Tags with PHP

I am trying to make simple custom tags to allow custom templates on my app. But I can't figure out how to parse and replace the tags. (example) <div class="blog"> <module display="posts" limit="10" show="excerpt" /> </div> <div class="sidebar"> <module display="users" limit="5" /> <module display="comment" limit="10" /> </div> for e...

Location Search - Google Maps

Does anyone have any suggestions on implementing a location search similar to that provided by google maps. Correctly parsing different geographic user inputs. Some examples would be City, State, Country City, State, Zipcode City, Zipcode I lot of directory sites use auto complete to avoid incorrect user input and aren't as intelli...