Tagged Questions

The tag has no wiki summary.

learn more… | top users | synonyms

-4
votes
1answer
16 views

Special Character check using Java Pattern

I want to generate Two patterns with below information, 1)The following special characters cannot be entered in the first name, last name, email, phone number fields in the Account form: Pattern " ...
1
vote
2answers
37 views

regex extract string between two characters

I would like to extract the strings between the following characters in the given string using regex in Java: /* 1) Between \" and \" ===> 12222222222 2) Between :+ and @ ===> 12222222222 ...
0
votes
1answer
20 views

Change matcher in Rspec 1.3 don't recognizes equal objects

I have that rspec test let(:document) { Document.new } let(:residue) { Residue.new } describe "inner_residue=" do before do document.producer_residue = residue end it 'dont changes the ...
1
vote
2answers
74 views

Break a long string into lines with proper word wrapping

String original = "This is a sentence.Rajesh want to test the application for the word split."; List matchList = new ArrayList(); Pattern regex = Pattern.compile(".{1,10}(?:\\s|$)", ...
1
vote
3answers
47 views

Java Regexp Matcher

Simple question about regexps. I've got String text = "foobar1foobar1"; And I need to get part before first 1 (foobar) When I do something like that: Pattern date_pattern = ...
0
votes
4answers
58 views

Search for any given string using JAVA REGEX

I am trying to write a generic method that will search a file for a given string and replace it with another string. I am using java regex for the same patternMatcher = Pattern.compile(searchString); ...
0
votes
1answer
30 views

index and offset have different meaning in Java Regex?

I'm bit confused with java doc about Matcher in the definition of start() and end(). http://docs.oracle.com/javase/1.5.0/docs/api/java/util/regex/Matcher.html#start() ...
0
votes
1answer
21 views

Jasmine Matching Return Value

I got some typical jasmine code such as: expect(actual).someMatcher(expected); Is there a way to determine whether this matching succeed or failed (programmatically)? Depending on the result, I ...
1
vote
1answer
45 views

Mockito acts strangely when I assign multiple custom matchers to a single method

I'm wanting to use two custom matchers for a single method. Basically, if I pass the method VALUE_A, I want it to return RESULT_A, and if I pass it VALUE_B, I want it to return RESULT_B. So here's a ...
1
vote
1answer
33 views

Use variables in pattern matcher

I have the following: if (mobile.matches("[0-9]{6,20}")) { ... } But would like to replace the {6,20} with variable values due to them been dynamic in some cases. I.e. int minValue = 11; int ...
1
vote
1answer
38 views

Regex “\\d+” finds integer twice in string: “{10}”. matcher matches 10 and 0

Im using regex to convert BitSet normal toString to a binary string. for instance if the myBitSet.toString() returns {10}, it sets the 10th and the 0th bit, but should only set the 10th. ... ...
1
vote
2answers
97 views

Java Regular Expression

I have a below peace of code : Pattern p = Pattern.compile("^\\d|^\\W|^\\s"); Matcher m = p.matcher("stack overflow"); Can somebody explain the above regex pattern ? What it does ? I ...
3
votes
2answers
107 views

Pattern/Matcher in Java?

I have a certain text in Java, and I want to use pattern and matcher to extract something from it. This is my program: public String getItemsByType(String text, String start, String end) { ...
0
votes
4answers
77 views

Parse a line using Pattern.compile

I am trying to parse following line, myline in Java and it keeps throwing the null value. Here is my try to get '000000010'. myline = "<status> <id>000000010</id> ...
3
votes
5answers
57 views

How do I parse a log line in Java delimited by keywords?

I'm working on a log parser that should parse a line like this: ID1 : 0 ID2 : 214 TYPE : ERROR DATE : 2012-01-11 14:08:07.432 CLASS : Maintenance SUBCLASS : Operations ID1, ID2, TYPE, ...

1 2 3 4 5 7
15 30 50 per page