0
votes
5answers
18 views

Java Regex - Ignoring size string in image url

I'm trying to remove the size specifications from image URL strings but I can't seem to find a solution. I don't much about regex so I tried [0-9x] but it only removed all numbers in the url rather ...
0
votes
3answers
31 views

Extract text between two tags using Regx

I have a text file in this format: <seg id="1"> They are the same thing. Let's shoot them both. </seg> <seg id="1"> We can't wait for you to move back either. </seg> ...
0
votes
3answers
30 views

Add separator in string using regex in Java

I have a string (for example: "foo12"), and I want to add a delimiting character in between the letters and numbers (e.g. "foo|12"). However, I can't seem to figure out what the appropriate code is ...
0
votes
2answers
50 views

Java Regex Output

I have written a reg expression in Java that validates a given address and then create groups that will separate out the street number & name, city, state & zip code. My code is as follows: ...
-1
votes
1answer
26 views

Calculator parse user input using regex

Have the next regex /+|-^[(-], which I use in String.split(regex) method. I want to split in situations when there is plus or minus, but if it's minus then don't split if before him there is opening ...
0
votes
0answers
26 views

How to convert regex into glob expression

I'd like to convert regular expression into glob I was looking on jakarta oro]1 But i can't find method that suits my needs. That it compiles regular expression and returns its glob equivalent They ...
1
vote
2answers
31 views

Java Split string containing pipe and new line characters

I am trying to split the below string and put in map - the below data may be in single line or multiple line. I want to avoid "\n" at starting of keys name in maps user.Split-A=1| ...
0
votes
1answer
31 views

Sqlite sorting using regex

Sqlite sorting using regex I have rows in an sqlite db text field (codes) with values like: M1 M2/4527 M101 1 2/5 3/1003 101 102 I wish to sort codes with all the rows that start with a number ...
0
votes
1answer
39 views

Reusing subpattern in regular expression

I have string like "operand sign operand". And pattern (?<operand>.* ([+|-] ?<operand>.*)*). Operand is more complicated then ".*". Can I put link to the first operand pattern to another ...
1
vote
4answers
32 views

Match any unicode Letters with java regex

I need to match any letters (like MS Office Word find with special character ^$ functionality) with regex. I've tried with [a-zA-Z] but don't match any unicode letters like accent letters or ä, ö, ü, ...
0
votes
2answers
35 views

Java Regex look-behinds

I have the following regular expression (?s)^(?<=.*Exception.*)<The server started in RUNNING mode.>, so basically I want to find any Exception that was thrown before the server starts ...
0
votes
1answer
13 views

Regex matching bracket in java scanner

I'm wondering is it possible to match bracket with regex expression say I need to find "[Detail]" in a text file but since "[]" is reserved it would result in selecting character "adeilt" which is ...
-1
votes
3answers
20 views

RegEx/Java - Retrieve values from String [on hold]

From the below string, I need to retrieve groupA, groupB & groupC String str = "(&(objectCategory=group)(|(cn=groupA) (cn=groupB) (cn=groupC) ))" How can this be achieved using Java?
0
votes
3answers
27 views

regex Pattern Matcher, how to store the rest of the string

String : USA (45) using pattern matching getting only numeric value 45 Java code ArrayList<String> portfolioCount = new ArrayList<String>(); String mainText = USA (45) final Pattern p = ...
1
vote
2answers
22 views

splitting a line on a multi character delimiter using pattern matching

I am running the following simple program: public class TestClass { public static void main(final String[] args) { String valid = "abc|~abc|~abc|~abc|~abc|~|~|~|~|~|~|~abc"; ...
0
votes
3answers
38 views

Using regex to match consonant letters

I want to search for consonant letters that happens 3 times consecutive i.e "happy" matches, "read" don't match I can do this by using this code String str; if ...
2
votes
2answers
42 views

Parsing unicode 'Vulgar Fractions' into double in Java

I am scraping some data of a web site and parts of it include fractions in unicode e.g. 6' 5¼". I have successfully used the regex (\\d)' (\\d{1,2}([\\xbc-\\xbe])?)\" to extract each part of the ...
1
vote
1answer
47 views

Java code to preserve special characters in arbitrary input

I'm working with a Struts2 program that constructs an email message using an email template file and replaces certain placeholder strings in the template with user input retrieved through a form ...
0
votes
1answer
43 views

Regexp annoyance

I'm trying to write a regexp that will match a string of numbers exactly 12 times (there may be an additional number at the beginning of the string, which I would then want to discard). I wrote this ...
0
votes
4answers
40 views

Split string at commas

I have some strings in Java, which look like the following: String s = ""Aac 1Zl Aachen",,DE,5048.850N,00611.483E,189.0m,1,,,,"AACHEN"" I wanna split the string at every comma and assign the ...
0
votes
0answers
44 views

Sequence recognition in a database

I have in a database a table "events" with differents types. In another table called "sequence", I have a sequence of type of events for examples : sequence 1 : type A,Type B, Type C sequence 2 : ...
-2
votes
3answers
69 views

Java String to Json & vice versa

I want to covert a string based protocol to Json, Performance is key The String based protocol is something like <START>A12B13C14D15<END> and json is {'A':12,'B':13,'C':14,'D':15} ...
0
votes
3answers
26 views

Regular expression for email using look ahead in java

I am trying to write a regular expression for email. For the characters before @ symbol, I want following rules to be obeyed: a-z,A-Z,0-9 are allowed along with special character -,.,_ I write ...
1
vote
1answer
32 views

Regex match Wikipedia internal article links

I want to regex match text in Wikipedia article source code with following rules: Match only links to internal articles. So don't match links with any namespaces like files, categories, users, ... ...
1
vote
4answers
57 views

Comment Detector using regex with java

I want to create beginning comment detector using regex with Java I'm using JTextArea area to paste source code program and JTextArea comment as print out comment Pattern aaa = ...
1
vote
3answers
37 views

allow only Alphanumeric values using java

i need to get the value which only Alphanumeric and it can be of anything which comes under this 1. asd7989 - true 2. 7978dfd - true 3. auo789dd - true 4. 9799 - false 5.any special characters - ...
1
vote
1answer
43 views

Regex for find Replace

In context of this question I want to do the following changes: Find: funcA(param0,param1,param2,param3); Replace: if(isTrue) funcB(param0,funcC(param1,param2,param3)); funcA can have ...
1
vote
3answers
45 views

How to replace last letter to another letter in java using regular expression

i have seen to replace "," to "." by using ".$"|",$", but this logic is not working with alphabets. i need to replace last letter of a word to another letter for all word in string containing ...
-1
votes
0answers
33 views

Conversion of C# Regex code to Java

I'm helping a friend convert some of his C# code over to Java when I came across some regex code. I'm only somewhat familiar with Regex in C#, and not at all familiar with it in Java, so any help ...
2
votes
2answers
41 views

what are possessive quantifiers in Java regular expression used for?

I'm reading about regular expression in Java. And I understand that possessive quantifiers do not backtrack and release characters to give a chance for other group to achieve a match. But I couldn't ...
1
vote
5answers
50 views

Regex to match a number or nothing

i need to get a regex that can match something like this : 1234 <CIRCLE> 12 12 12 </CIRCLE> 1234 <RECTANGLE> 12 12 12 12 </RECTANGLE> i've come around to write this regex : ...
0
votes
2answers
38 views

How do I get detect a pattern including an arbitrary string?

I have a response system, and I'm trying to get it so you can input a String, and it matches it to the most likely String in its database by looping through each one and measuring the Levinshtein ...
-1
votes
2answers
37 views

How to print a word after a phrase using regular expression

It must be written in java using regular expression I need to print a word after "what is" Input: So what is java regex what is operator in java Output: java operator
1
vote
5answers
74 views

How to check wether a string contains the search items

I have a String and a String[] filled with search items. How can I check whether my String contains all of the search items? Here is an example: Case 1: String text = "this is a stupid test"; ...
-7
votes
3answers
57 views

Explain this regular expression in Java [on hold]

Regular expression in java: 'String'.replaceAll("([aeioucgjkqsxyzbfpvwdtmn1234567890])\\1+", "$1") Can someone explain what the different characters do?
1
vote
2answers
33 views

Regular expressions in VBScript v/s Regular expressions in Java

While doing a feasibility analysis of a GUI application, we are comparing QTP (VBScript) and Selenium (Java) tools. Selenium being a open source tool does have the advantage when it comes to cost. The ...
1
vote
2answers
46 views

Regex convert to convert a string to tab delimited field

I want to convert a string to get tab delimited format. In my opinion option 1 should do it. But it looks like option 2 is actually producing the desired result. Can someone explain why? public class ...
1
vote
1answer
35 views

Matcher find() method returns StringOutOfBounds exception

I just started using Java regular expressions at work, and am having trouble with using the Matcher find() method. In the following code, i is a String parameter received from the client, and 'list' ...
0
votes
2answers
33 views

Splitter in Mule 3.2

I'm using a splitter in a Mule flow, as described on the answer to this question: Mule splitter using regex returned no results However, when I try to do something similar on Mule 3.2, I get the ...
-6
votes
3answers
32 views

Regex to match end-of-sentence markers [on hold]

I need to match all the end-of-sentence symbols like !, ?, . (period), etc. in a given body of text. Can anyone help me out with the regex for doing such a thing? Example Input: This is the f!!rst ...
0
votes
2answers
44 views

How to separate string in text file into different array (java)

I have a text file that consist of string. What i want to do is to separate the string with "[ham]" and the string with "[spam]" inside to the different array, how can i do that, i think about to use ...
0
votes
1answer
25 views

Filter list according to Current date android

I have a ArrayList<CustomObject> which contains some entries. Each entry has a Date associated with it. Currently, the date is stored as a String. eg "2014-09-23T12:45:00" I want to filter the ...
0
votes
1answer
18 views

Concatenate multiple commands

How can I manipulate this regular expression String oneCmd = "([0-9]+\\.[tcm]{1}\\#.+\\#[wsn]{1})"; to avoid matching "100.m#testValue#w100.m#testValue#w" but allow matching 100.m#testValue#w ...
0
votes
1answer
27 views

How to express this pattern with java regex?

I'm working on a java program that tries extracts a string with the format: |something|= from different string inputs, where |something| has the following constraints: |something| can not ...
0
votes
1answer
15 views

Log4j2 regular expressions

I am working with the log4j2 configuration file settings to try and make the config file use regular expressions so the it can use multiple classes in the logger property and name attribute. This is ...
0
votes
4answers
40 views

Convert functions of math to functions of javascript in java

I have made a String Mathematical expression Parser as follows: public class ExpSolver { public String solve(String s){ try { ScriptEngineManager mgr = new ScriptEngineManager(); ...
0
votes
1answer
25 views

How to check if one pattern is included into another

For example, I have the following regular expression: /lol.* All strings that matches this expression also matches another expression: /l.* How to check that first regex is included into ...
0
votes
2answers
46 views

Adding special characters to an array

I have a function that adds capitals, lowercase, and 0-9 to a character array and now i want to add special characters such as !@#$%^&*(). The format for my array goes like this: for (char ch = ...
0
votes
3answers
62 views

Spliting a string on the basis of regex

I have the following text file "Zanesville,OH" +39.93830 -82.00830 84ZC PMNQ "Zaragoza,Spain" +41.66670 -1.05000 GWC7 PXB0 "Zurich,Switzerland" ...
1
vote
2answers
35 views

Non-Capturing group regex not working in Java

The online REGEX testers shows the non-captuting groups are getting ignored but from java code it is not ignored. import java.util.*; import java.lang.*; import java.io.*; import ...