parse « parse « Java Regex Q&A

Home
Java Regex Q&A
1.Development
2.find
3.group
4.Match
5.matcher
6.number
7.Operation
8.parse
9.Pattern
10.replace
11.validation
12.word
Java Regex Q&A » parse » parse 

1. Alternatives to Regular Expressions    stackoverflow.com

I have a set of strings with numbers embedded in them. They look something like /cal/long/3/4/145:999 or /pa/metrics/CosmicRay/24:4:bgp:EnergyKurtosis. I'd like to have an expression parser that is

  • Easy to use. ...

2. Regular expression to parse option string    stackoverflow.com

I'm using the Java matcher to try and match the following:

@tag TYPE_WITH_POSSIBLE_SUBTYPE -PARNAME1=PARVALUE1 -PARNAME2=PARVALUE2: MESSAGE
The TYPE_WITH_POSSIBLE_SUBTYPE consists of letters with periods. Every parameter has to consist of letters, and every value has ...

3. String delimited regular expression    stackoverflow.com

I'm trying to build a bbcode parser, but I'm having quite some problems figuring out how to avoid matching too widely. For example I want to implement a [list] to ...

4. Given a string, generate a regex that can parse *similar* strings    stackoverflow.com

For example, given the string "2009/11/12" I want to get the regex ("\d{2}/d{2}/d{4}"), so I'll be able to match "2001/01/02" too. Is there something that does that? Something similar? Any idea' as ...

5. Java Regex for parsing adventure game config    stackoverflow.com

Can anyone give me a hand with a touch of regex? I'm reading in a list of "locations" for a simple text adventure (those so popular back in the day). However, I'm ...

6. What is an efficient way to parse a String in Java?    stackoverflow.com

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 ...

7. Parsing search query    stackoverflow.com

I need to parse a search query with a "Google-like" syntax (but simpler, since I don't need parenthesis, operator nesting and such). An example string might be: TAG1: a,b,c TAG2: 123 TAG3: ...

8. java: using regex to parse repeated substrings    stackoverflow.com

This is specifically aimed at parsing hex bytes, but there's a more general question here. Suppose I have a regexp r e.g. \\s*([0-9A-Fa-f]{2})\\s* (optional spaces, 2 hex digits that I'm interested in, ...

9. String parsing with regular expressions    stackoverflow.com

I have a following string that I would like to parse into either a List or a String[].

(Test)(Testing (Value))
End result should be Test and Testing (Value)

10. Parse values from a string    stackoverflow.com

How would you parse the values in a string, such as the one below?

12:40:11  8    5            ...

11. Parsing command-line arguments from a STRING in Clojure    stackoverflow.com

I'm in a situation where I need to parse arguments from a string in the same way that they would be parsed if provided on the command-line to a Java/Clojure application. For ...

12. How to parse out Timestamp from this String?    stackoverflow.com

I have this sample string:

Sample string 1:
A^1.1#B^1#I^2#f^0#p^1#d^2010-07-21T08:52:05.222ZKHBDGSLKHFBDSLKFGNIF#%$%^$#^$XLGCREWIGMEWCERG

Sample string 2:
A^1.1#B^1#f^0#p^1#d^2010-07-22T07:02:05.370ZREGHCOIMIYR$#^$#^$#^EWMGCOINNNNNNVVVRFGGYVJ667VTG
So, from these strings, I need to take out the time stamp:
2010-07-21T08:52:05.222 or
2010-07-22T07:02:05.370
Basically values b/w d^ and Z What is the best ("smartest") way ...

13. Java: how to parse double from regex    stackoverflow.com

I have a string that looks like "A=1.23;B=2.345;C=3.567" I am only interested in "C=3.567" what i have so far is:

     Matcher m = Pattern.compile("C=\\d+.\\d+").matcher("A=1.23;B=2.345;C=3.567");

    while(m.find()){ 
 ...

14. Parsing a string of, whitespace separated, ordered but optional elements    stackoverflow.com

This is a generalization of a specific problem I am trying to solve. Given a string of uniquely identifiable elements separated by a single space:

0 1 2 3 4
Without modifying the string, ...

15. Java: how to collect incoming data fragments into properly terminated strings for subsequent parsing?    stackoverflow.com

I just joined StackOverflow after having found many great answers here in the past. Here's my first question: EDIT: I feel bad... my first question to StackOverflow turned out to be a ...

16. Parsing Numeric Values with Java's Regular Expression Classes    stackoverflow.com

In Java, I'm attempting to parse data from an ASCII output file. A sample of the data looks is show below. The values are formatted precision 5 scale 3 and no ...

17. How to parse word-created special chars in java    stackoverflow.com

I am trying to parse some word documents in java. Some of the values are things like a date range and instead of showing up like Startdate - endDate I am ...

18. Making values in to objects using Regex (Java)    stackoverflow.com

I have some data that looks like this

myobject{keyone:"valueone",keytwo:"valuetwo",keythree:"valuethree"}
myobject{keyone:"valueone",keytwo:"valuetwo",keythree:"valuethree"}
myobject{keyone:"valueone",keytwo:"valuetwo",keythree:"valuethree"}
And I'm wondering what the best way to create a bunch of objects from it would be. I've written the following regex to extract ...

19. How do I parse this string with regex?    stackoverflow.com

I have a string like:

"GOOG",625.00,"-1.95 - -0.31%"
I'm using this pattern, and it isn't matching. I'm trying to get GOOG. What am I doing wrong?
Pattern pattern = Pattern.compile("^\"([^\"]+)");
Matcher matcher ...

20. How to parse this string using regex or another technique?    stackoverflow.com

I have a string:

hello example >> hai man
How can I extract the "hai man" using Java regex or another technique?

21. Is this the most efficient way to parse the string?    stackoverflow.com

I have a string of the form AU 12345T or AU 12345T1; basically it is of the form alphabet characters(s) followed by a number then ending in a one or two ...

22. EBNF / parboiled: how to translate regexp into PEG?    stackoverflow.com

This is a question both specific to the parboiled parser framework, and to BNF/PEG in general. Let's say I have the fairly simple regular expression

^\\s*([A-Za-z_][A-Za-z_0-9]*)\\s*=\\s*(\\S+)\\s*$
which represents the pseudo-EBNF of
<line>    ...

23. String parsing: how to isolate parameters when a parameter can be a nested function    stackoverflow.com

In java, I'm trying to process functions of the from FUNC{parameter,parameter} using regular expressions. I've isolated the string containing the parameters, and now I have to extract them from the string. My ...

24. Regexp equivalent of str.getSubstring(x, y);    stackoverflow.com

What would be a RegExp equivalent of substring from position x to position y? For example:

0001..STACK.OVERFLOW...IS.AWESOME.13052011
I know that the value of a field called 'status' in this fixed length string is ...

25. How do I parse the last 6 digits of a string using regex in Java?    stackoverflow.com

I would like to know how to parse the last 6 digits from a Java string. So:

String input1 = "b400" // the regex should return b400  
String input2 = "101010" ...

26. Parsing wikiText with regex in Java    stackoverflow.com

Given a wikiText string such as:

{{ValueDescription
    |key=highway
    |value=secondary
    |image=Image:Meyenburg-L134.jpg
    |description=A highway linking large towns.
    |onNode=no
  ...

27. parsing a string by regular expression    stackoverflow.com

I have a string of

"name"=>"3B Ae", "note"=>"Test fddd \"33 Ae\" FIXME", "is_on"=>"keke, baba"
and i want to parse it by a java program into segments of
name
3B Ae
note
Test fddd \"33 Ae\" FIXME
is_on
keke, ...

28. Regex for key-value-pair including unescaped whitespace    stackoverflow.com

I need a regex for parsing key-value-pairs from a properties-file to write them into a database. The application is written in java. As I need to store information about comment-lines and ...

29. parse String with Regex    stackoverflow.com

I have an extremely long string that I want to parse for a numeric value that occurs after the substring "ISBN". However, this grouping of 13 digits can be arranged differently ...

30. Java - Regex help?    stackoverflow.com

I cannot seem to grasp the whole concept of regular expressions, I've been working with php for a couple years now and have, for the most part, tried to avoid the ...

31. java.lang.StackOverflowError while using a RegEx to Parse big strings    stackoverflow.com

This is my Regex

((?:(?:'[^']*')|[^;])*)[;]
It tokenizes a string on semicolons. For example,
Hello world; I am having a problem; using regex;
Result is three strings
Hello world
I am having a problem
using regex
But when I use ...

32. Regular expression for parsing string in key value pair in java    stackoverflow.com

I have this string:

"{ '_id' : ObjectId('4e85ba250364e5a1857ba2e4'), 
   'message' : '<user=animesh@strumsoft.com>, <action=create-flock>, 
      params=[<title=[smile.animesh@gmail.com, ram@strumsoft.com], 
      attendees=immediate, flockType=immediate, duration=30]>' ...

33. parse string with potentially 2 occurrences of the same string    stackoverflow.com

I'm working on parsing an address string and have found that sometimes the street name contains a word that is also a valid city name. I want to be sure ...

34. Parsing the CN out of a certificate DN    stackoverflow.com

Let me begin by stating that this is a question of aesthetics. I've solved my own problem, I'm just curious about better ways of doing it. So, I've got a certificate ...

35. How to parse string with Java?    stackoverflow.com

I am trying to make a simple calculator application that would take a string like this

5 + 4 + 3 - 2 - 10 + 15
I need Java to parse this ...

36. java auto correct pattern-matcher - which item is the most similar in a given set?    stackoverflow.com

I was wondering how to implement the following problem: Say I have a 'set' of Strings and I wish to know which one is the most related to a given value. Example: ...

37. Java. Regular Expression. How Parse?    stackoverflow.com

As input parameters I can have two types of String:

codeName=SomeCodeName&codeValue=SomeCodeValue
or
codeName=SomeCodeName 
without codeValue. codeName and codeValue are the keys. How can I use regular expression to return the key's values? In this ...

38. java parse forloop statement    stackoverflow.com

Im making a program visualization and im using gdb as an interpreter. The variables inside the forloop statment will be used in 'display variable_name' command so that I can track values ...

39. Help Improve Regex Parsing    coderanch.com

A while back I posted a problem with recursive syntax and regex. I couldn't do what I really wanted so I'm doing what feels like a bit of a hack. I got regex to find the innermost macro call in a nested expression. In a loop I replace the innermost with the results of the macro call and search again. Next ...

40. The regular expression to parse (abc.3, d.42), (cde.2, 3)    coderanch.com

Hi, I want to construct a regular expression to divide the string (abc.3, d.42), (cde.2, 3) into 2 groups: 1. abc.3, d.42 2. cde.2, 3 I tried the following regular expression \\([.*]\\) in String.split(), but it returns an empty array. Please help me to see what is wrong with my regular expression. Thanks! Greg

41. Parsing a regular expression    coderanch.com

Write a program in Java that can parse a mathematical expression String, calculate the expression, and produce a numeric result. For example, given the string: "2.5+3*4+6/12-7" produce the result 8.0 Requirements: Parser * expression can contain Integers or floating-point numbers * expression can contain Operators for addition, subtraction, division and multiplication * parser should throw an Exception when the expression is ...

42. Doubt in Parsing(Regex)    coderanch.com

This thread is much more confusing than it needs to be. Dash's pseudocode implies that he's matching the regex "aaaaa" against the target string "a*", which is backward. Then we learn from the the quoted text in Marilyn's reply (quoted from where, I wonder? - edit: never mind, it came from here) that the regex is really "a?", which is good, ...

43. java parsing using regular expression    coderanch.com

http://www.csc.liv.ac.uk/teaching/modules/year3s1/comp304.html i need to parse this page and extract the member of staff on this page using regular expression. Using java.utility.regex i only need the regular expression rest code i have done ////// import java.io.*; import java.net.*; import java.util.regex.*; class Spider{ public static void main(String []argv){ try { URL url = new URL("http://www.csc.liv.ac.uk/teaching/modules/year3s1/comp304.html"); URLConnection urlConnection = url.openConnection(); DataInputStream dis = new ...

44. Parsing using regular expression    coderanch.com

Hi All, I need to parse a formula which can have comments. A valid formula will be something like this. B = rescale(A,'monthly') +33 ; 'this is a comment The formula should end with semicolon ";" and a comments can start with single quote('). If a formula does not end with semi colon then i should throw an Exception (Syntax error) ...

45. parse simple string with regex?    java-forums.org

46. Help with parsing website with regex please    java-forums.org

Ohh I see, well thanks for that. So I guess it isn't allowed unless I show the map too. But I don't think they'd find out :S. All i'm doing is downloading their page to my hard drive, its like opening a web browser. Once the page is on my hard drive, I'm just doing myself the pleasure of showing myself ...

47. RegExp rather than parse    forums.oracle.com

(My first instinct says to simply add " s" in the regex since that will match a newline as well as whitespace, or just ".*" to match any character, but since I'm reading it in with a while loop, I don't know if that applies, so here's the code I have reading from the URL:)

48. regular expression trouble while parsing CSS    forums.oracle.com

I agree on the CSS parser idea and very observant readers might have noticed that my test class is called CSSParserTwo. CSSParserOne was my first try using the css parser from http://cssparser.sourceforge.net/ and the interface library from http://www.w3.org/Style/CSS/SAC/. Unfortunately this idea didn't work so well. First the parser believes that I should be interested in the layout stuff and removes the ...

49. parsing using regex    forums.oracle.com

50. parsing stringwith regex    forums.oracle.com

51. Problem with String parsing and regular expressions    forums.oracle.com

Hi everyone, i need help with regular expressions and String parsing. There is a String command with a command to execute. This String must be checked if there are substrings like: $[[attribute], ''label] where "label" can be any possible string. If there is substring like that then JDialog should be created with JLabel with value from "label" (or any else) and ...

52. regex: parsing out nested divs    forums.oracle.com

i dunno about pumping lemmas...that article hurt my brain. but, it looks very much like the problem you have to solve when you are dealing with parathesis in an inline algebraic equation. you use stacks (at least two) to find out if they are balanced by pushing when you encounter the left and popping when you encounter the right. if you ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.