Tagged Questions
-2
votes
0answers
63 views
What is the regular expresion algorithm in java [on hold]
I am interested to know how regular expressions in JAVA work (To expand my general knowledge :-) ).
I tried to read the code of the Pattern class and got lost.
Is there a document which explains how ...
3
votes
2answers
32 views
Java regex with a positive look behind of a negative look ahead
I am trying to extract from this kind of string ou=persons,ou=(.*),dc=company,dc=org the last string immediately preceded by a coma not followed by (.*). In the last case, this should give ...
2
votes
2answers
43 views
Java - replace all instances of path separators with system path separator
I've taken the regex matching both slash and backslash from this answer: Regex to match both slash in JAVA
String path = "C:\\system/properties\\\\all//";
String replaced = ...
2
votes
6answers
64 views
Java regex in scanner
I know it is simple, but I do not know why it does not work.
I try to check if next String in scanner is matched by the pattern:
String should begins with
" DESCRIPTION".
So, I try:
Scanner sc = ...
-4
votes
2answers
49 views
What does this regular expression mean specifically the single part? [on hold]
I understand the latter part of this expression, however what does \d{2} represents in this regular expression
"(\\d{2}(0[1-9]|1[012]|[0]{2}))";
0
votes
3answers
54 views
java String.split(regex) design
I'm importing a file with umpteen lines of "##,##". Each number can be one or two digits.
I'd like to use String.split(regex) to get the two numbers without the adjacent quote marks.
Understanding ...
0
votes
3answers
44 views
Writing regex to find consecutive character 'o'
I wrote a regex to detect the a repeating o at the end of a word. Here's my regex;
Pattern p = Pattern.compile(".*[o]\\1+");
For example if i have a word zoo, masoo or kjuoo, it should be detected ...
1
vote
3answers
57 views
Trimming digits at the end of String
I want to trim the last occurring numeric characters from the String
Eg:
"abc123" => "abc"
"abc12xyz34" => "abc12xyz"
Written below snippet to extract it. Just want to explore if this can be ...
0
votes
3answers
79 views
Java validate price with comma or dot and two decimal value [on hold]
What is the best way and the solution to validate a string that must represents a price value with dot or comma and with maximum two decimal values?
RegExp, java.text.DecimalFormat or something else?
...
0
votes
0answers
63 views
Regex for detecting Dynamic SQL
My apologies if this is confusing, as I am a beginner at SQL, and not familiar with the standard terms, so here goes...
I am writing an SQL code beautifier in java, using regex to detect SQL syntax ...
4
votes
2answers
56 views
Writing a regex to detect repeat-characters [duplicate]
I need to write a regex, that would identify a word that have a repeating character set at the end. According to the following code fragment, the repeating character set is An. I need to write a regex ...
3
votes
1answer
59 views
Java Regex not recognizing the string
I am trying to find if a string fits the format "name"/"version". Here is an example of what I expect to have.
VideoPart/1.2
I've tried many regexes. The closest I have come is this:
...
-1
votes
5answers
61 views
Replace every match but the first
I need a regular expression to do the following:
I have this String: 123.45.678.7 and I need to replace all (.) characters from the second. The result will be 123.456787
¿Can anyone help me please?
...
1
vote
3answers
80 views
Splitting sentences at spaces but not in html tags [on hold]
I want to split a senctence at the whitespaces in java. But in the text they are html tags and I don't want to split the words here.
So for example "hello <a>John Smith</a> hey ho" should ...
0
votes
3answers
55 views
Regex to match nested json objects
I'm implementing some kind of parser and I need to locate and deserialize json object embedded into other semi-structured data. I used regexp:
\\{\\s*title.*?\\}
to locate object
{title:'Title'}
...