Search Results

Search found 118 results on 5 pages for 'matcher'.

Page 1/5 | 1 2 3 4 5  | Next Page >

  • How to compose a Matcher[Iterable[A]] from a Matcher[A] with specs testing framework

    - by Garrett Rowe
    If I have a Matcher[A] how do create a Matcher[Iterable[A]] that is satisfied only if each element of the Iterable satisfies the original Matcher. class ExampleSpec extends Specification { def allSatisfy[A](m: => Matcher[A]): Matcher[Iterable[A]] = error("TODO") def notAllSatisfy[A](m: => Matcher[A]): Matcher[Iterable[A]] = allSatisfy(m).not "allSatisfy" should { "Pass if all elements satisfy the expectation" in { List(1, 2, 3, 4) must allSatisfy(beLessThan(5)) } "Fail if any elements do not satisfy the expectation" in { List(1, 2, 3, 5) must notAllSatisfy(beLessThan(5)) } } }

    Read the article

  • Pattern/Matcher in Java?

    - by user1007059
    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) { String patternHolder; StringBuffer itemLines = new StringBuffer(); patternHolder = start + ".*" + end; Pattern pattern = Pattern.compile(patternHolder); Matcher matcher = pattern.matcher(text); while (matcher.find()) { itemLines.append(text.substring(matcher.start(), matcher.end()) + "\n"); } return itemLines.toString(); } This code works fully WHEN the searched text is on the same line, for instance: String text = "My name is John and I am 18 years Old"; getItemsByType(text, "My", "John"); immediately grabs the text "My name is John" out of the text. However, when my text looks like this: String text = "My name\nis John\nand I'm\n18 years\nold"; getItemsByType(text, "My", "John"); It doesn't grab anything, since "My" and "John" are on different lines. How do I solve this?

    Read the article

  • Java Matcher groups: Understanding The difference between "(?:X|Y)" and "(?:X)|(?:Y)"

    - by user358795
    Can anyone explain: Why the two patterns used below give different results? (answered below) Why the 2nd example gives a group count of 1 but says the start and end of group 1 is -1? public void testGroups() throws Exception { String TEST_STRING = "After Yes is group 1 End"; { Pattern p; Matcher m; String pattern="(?:Yes|No)(.*)End"; p=Pattern.compile(pattern); m=p.matcher(TEST_STRING); boolean f=m.find(); int count=m.groupCount(); int start=m.start(1); int end=m.end(1); System.out.println("Pattern=" + pattern + "\t Found=" + f + " Group count=" + count + " Start of group 1=" + start + " End of group 1=" + end ); } { Pattern p; Matcher m; String pattern="(?:Yes)|(?:No)(.*)End"; p=Pattern.compile(pattern); m=p.matcher(TEST_STRING); boolean f=m.find(); int count=m.groupCount(); int start=m.start(1); int end=m.end(1); System.out.println("Pattern=" + pattern + "\t Found=" + f + " Group count=" + count + " Start of group 1=" + start + " End of group 1=" + end ); } } Which gives the following output: Pattern=(?:Yes|No)(.*)End Found=true Group count=1 Start of group 1=9 End of group 1=21 Pattern=(?:Yes)|(?:No)(.*)End Found=true Group count=1 Start of group 1=-1 End of group 1=-1

    Read the article

  • Setting up Matcher for String phrase match in file

    - by randomCoder
    Having trouble figuring out how to match a phrase string to a phrase in file stream. The file I'm dealing with contains random words such as: 3 little pigs built houses and 1 little pig went to the market etc. for many lines Using "little pig" as my pattern and matcher.find() I can locate 2 matches: "little pig" and "little pigs". However, I only want it to match "little pig". What can I do? I thought about using matcher.lookingAt() but I wouldn't know how to set a proper region when I can't rely on the file string phrases I'm matching being on separate lines.

    Read the article

  • Java Regex Matcher Question

    - by Yang
    How do I match an URL string like this: img src = "http://stackoverflow.com/a/b/c/d/someimage.jpg" where only the domain name and the file extension (jpg) is fixed while others are variables? The following code does not seem working: Pattern p = Pattern.compile("<img src=\"http://stachoverflow.com/.*jpg"); // Create a matcher with an input string Matcher m = p.matcher(url); while (m.find()) { String s = m.toString(); }

    Read the article

  • How to replace a regexp group with a post proceed value?

    - by Pentium10
    I have this code to public static String ProcessTemplateInput(String input, int count) { Pattern pattern = Pattern.compile("\\{([^\\}]+)\\}"); Matcher matcher = pattern.matcher(input); while (matcher.find()) { String newelem=SelectRandomFromTemplate(matcher.group(1), count); } return input; } Input is: String s1 = "planets {Sun|Mercury|Venus|Earth|Mars|Jupiter|Saturn|Uranus|Neptune}{?|!|.} Is this ok? "; Output example: String s2="planets Sun, Mercury. Is this ok? "; I would like to replace the {} set of templates with the picked value returned by the method. How do I do that in Java1.5?

    Read the article

  • Parsing files "/etc/default" using java

    - by rmarimon
    I'm trying to parse the configuration files usually found in /etc/default using java and regular expressions. So far this is the code I have iterating over every line on each file: // remove comments from the line int hash = line.indexOf("#"); if (hash >= 0) { line = line.substring(0, hash); } // create the patterns Pattern doubleQuotePattern = Pattern.compile("\\s*([a-zA-Z_][a-zA-Z_0-9]*)\\s*=\\s*\"(.*)\"\\s*"); Pattern singleQuotePattern = Pattern.compile("\\s*([a-zA-Z_][a-zA-Z_0-9]*)\\s*=\\s*\\'(.*)\\'\\s*"); Pattern noQuotePattern = Pattern.compile("\\s*([a-zA-Z_][a-zA-Z_0-9]*)\\s*=(.*)"); // try to match each of the patterns to the line Matcher matcher = doubleQuotePattern.matcher(line); if (matcher.matches()) { System.out.println(matcher.group(1) + " == " + matcher.group(2)); } else { matcher = singleQuotePattern.matcher(line); if (matcher.matches()) { System.out.println(matcher.group(1) + " == " + matcher.group(2)); } else { matcher = noQuotePattern.matcher(line); if (matcher.matches()) { System.out.println(matcher.group(1) + " == " + matcher.group(2)); } } } This works as I expect but I'm pretty sure that I can make this way smaller by using better regular expression but I haven't had any luck. Anyone know of a better way to read these types of files?

    Read the article

  • StackOverflowError occured as using java.util.regex.Matcher

    - by Captain Kidd
    Hi guys I try to catch text by Regular Expression. I list codes as follows. Pattern p=Pattern.compile("<@a>(?:.|\\s)+?</@a>"); Matcher m = p.matcher(fileContents.toString()); while(m.find()) { //Error will be thrown at this point System.out.println(m.group()); } If the length of text I want to catch is too long, system will throw me a StackOverflowError. Otherwise, the codes work well. Please help me how to solve this problem.

    Read the article

  • Spring security request matcher is not working with regex

    - by Felipe Cardoso Martins
    Using Spring MVC + Security I have a business requirement that the users from SEC (Security team) has full access to the application and FRAUD (Anti-fraud team) has only access to the pages that URL not contains the words "block" or "update" with case insensitive. Bellow, all spring dependencies: $ mvn dependency:tree | grep spring [INFO] +- org.springframework:spring-webmvc:jar:3.1.2.RELEASE:compile [INFO] | +- org.springframework:spring-asm:jar:3.1.2.RELEASE:compile [INFO] | +- org.springframework:spring-beans:jar:3.1.2.RELEASE:compile [INFO] | +- org.springframework:spring-context:jar:3.1.2.RELEASE:compile [INFO] | +- org.springframework:spring-context-support:jar:3.1.2.RELEASE:compile [INFO] | \- org.springframework:spring-expression:jar:3.1.2.RELEASE:compile [INFO] +- org.springframework:spring-core:jar:3.1.2.RELEASE:compile [INFO] +- org.springframework:spring-web:jar:3.1.2.RELEASE:compile [INFO] +- org.springframework.security:spring-security-core:jar:3.1.2.RELEASE:compile [INFO] | \- org.springframework:spring-aop:jar:3.0.7.RELEASE:compile [INFO] +- org.springframework.security:spring-security-web:jar:3.1.2.RELEASE:compile [INFO] | +- org.springframework:spring-jdbc:jar:3.0.7.RELEASE:compile [INFO] | \- org.springframework:spring-tx:jar:3.0.7.RELEASE:compile [INFO] +- org.springframework.security:spring-security-config:jar:3.1.2.RELEASE:compile [INFO] +- org.springframework.security:spring-security-acl:jar:3.1.2.RELEASE:compile Bellow, some examples of mapped URL path from spring log: Mapped URL path [/index] onto handler 'homeController' Mapped URL path [/index.*] onto handler 'homeController' Mapped URL path [/index/] onto handler 'homeController' Mapped URL path [/cellphone/block] onto handler 'cellphoneController' Mapped URL path [/cellphone/block.*] onto handler 'cellphoneController' Mapped URL path [/cellphone/block/] onto handler 'cellphoneController' Mapped URL path [/cellphone/confirmBlock] onto handler 'cellphoneController' Mapped URL path [/cellphone/confirmBlock.*] onto handler 'cellphoneController' Mapped URL path [/cellphone/confirmBlock/] onto handler 'cellphoneController' Mapped URL path [/user/update] onto handler 'userController' Mapped URL path [/user/update.*] onto handler 'userController' Mapped URL path [/user/update/] onto handler 'userController' Mapped URL path [/user/index] onto handler 'userController' Mapped URL path [/user/index.*] onto handler 'userController' Mapped URL path [/user/index/] onto handler 'userController' Mapped URL path [/search] onto handler 'searchController' Mapped URL path [/search.*] onto handler 'searchController' Mapped URL path [/search/] onto handler 'searchController' Mapped URL path [/doSearch] onto handler 'searchController' Mapped URL path [/doSearch.*] onto handler 'searchController' Mapped URL path [/doSearch/] onto handler 'searchController' Bellow, a test of the regular expressions used in spring-security.xml (I'm not a regex speciality, improvements are welcome =]): import java.util.Arrays; import java.util.List; public class RegexTest { public static void main(String[] args) { List<String> pathSamples = Arrays.asList( "/index", "/index.*", "/index/", "/cellphone/block", "/cellphone/block.*", "/cellphone/block/", "/cellphone/confirmBlock", "/cellphone/confirmBlock.*", "/cellphone/confirmBlock/", "/user/update", "/user/update.*", "/user/update/", "/user/index", "/user/index.*", "/user/index/", "/search", "/search.*", "/search/", "/doSearch", "/doSearch.*", "/doSearch/"); for (String pathSample : pathSamples) { System.out.println("Path sample: " + pathSample + " - SEC: " + pathSample.matches("^.*$") + " | FRAUD: " + pathSample.matches("^(?!.*(?i)(block|update)).*$")); } } } Bellow, the console result of Java class above: Path sample: /index - SEC: true | FRAUD: true Path sample: /index.* - SEC: true | FRAUD: true Path sample: /index/ - SEC: true | FRAUD: true Path sample: /cellphone/block - SEC: true | FRAUD: false Path sample: /cellphone/block.* - SEC: true | FRAUD: false Path sample: /cellphone/block/ - SEC: true | FRAUD: false Path sample: /cellphone/confirmBlock - SEC: true | FRAUD: false Path sample: /cellphone/confirmBlock.* - SEC: true | FRAUD: false Path sample: /cellphone/confirmBlock/ - SEC: true | FRAUD: false Path sample: /user/update - SEC: true | FRAUD: false Path sample: /user/update.* - SEC: true | FRAUD: false Path sample: /user/update/ - SEC: true | FRAUD: false Path sample: /user/index - SEC: true | FRAUD: true Path sample: /user/index.* - SEC: true | FRAUD: true Path sample: /user/index/ - SEC: true | FRAUD: true Path sample: /search - SEC: true | FRAUD: true Path sample: /search.* - SEC: true | FRAUD: true Path sample: /search/ - SEC: true | FRAUD: true Path sample: /doSearch - SEC: true | FRAUD: true Path sample: /doSearch.* - SEC: true | FRAUD: true Path sample: /doSearch/ - SEC: true | FRAUD: true Tests Scenario 1 Bellow, the important part of spring-security.xml: <security:http entry-point-ref="entryPoint" request-matcher="regex"> <security:intercept-url pattern="^.*$" access="ROLE_SEC" /> <security:intercept-url pattern="^(?!.*(?i)(block|update)).*$" access="ROLE_FRAUD" /> <security:access-denied-handler error-page="/access-denied.html" /> <security:form-login always-use-default-target="false" login-processing-url="/doLogin.html" authentication-failure-handler-ref="authFailHandler" authentication-success-handler-ref="authSuccessHandler" /> <security:logout logout-url="/logout.html" success-handler-ref="logoutSuccessHandler" /> </security:http> Behaviour: FRAUD group **can't" access any page SEC group works fine Scenario 2 NOTE that I only changed the order of intercept-url in spring-security.xml bellow: <security:http entry-point-ref="entryPoint" request-matcher="regex"> <security:intercept-url pattern="^(?!.*(?i)(block|update)).*$" access="ROLE_FRAUD" /> <security:intercept-url pattern="^.*$" access="ROLE_SEC" /> <security:access-denied-handler error-page="/access-denied.html" /> <security:form-login always-use-default-target="false" login-processing-url="/doLogin.html" authentication-failure-handler-ref="authFailHandler" authentication-success-handler-ref="authSuccessHandler" /> <security:logout logout-url="/logout.html" success-handler-ref="logoutSuccessHandler" /> </security:http> Behaviour: SEC group **can't" access any page FRAUD group works fine Conclusion I did something wrong or spring-security have a bug. The problem already was solved in a very bad way, but I need to fix it quickly. Anyone knows some tricks to debug better it without open the frameworks code? Cheers, Felipe

    Read the article

  • Problem with URI matcher in Android.

    - by Lunchbox
    I have an authority string defined as such: public final static String AUTHORITY = "dsndata.sds2mobile.jobprovider"; Followed by an edition to the UriMatcher: uriMatcher.addURI(JobMetaData.AUTHORITY, "/JobNames/*", JOBNAME_SINGLE_URI); The uri that gets passed to the switch is: content://dsndata.sds2mobile.jobprovider/JobNames/test This falls through the switch and hits the default (which throws an IllegalArgumentException). Am I missing something? I've searched and can't find anything that would account for the mismatch.

    Read the article

  • Java Split not working as expected

    - by daaabears
    I am trying to use a simple split to break up the following string: 00-00000 My expression is: ^([0-9][0-9])(-)([0-9])([0-9])([0-9])([0-9])([0-9]) And my usage is: String s = "00-00000"; String pattern = "^([0-9][0-9])(-)([0-9])([0-9])([0-9])([0-9])([0-9])"; String[] parts = s.split(pattern); If I play around with the Pattern and Matcher classes I can see that my pattern does match and the matcher tells me my groupCount is 7 which is correct. But when I try and split them I have no luck.

    Read the article

  • During suite tests EasyMock says 0 matchers expected 1 recorded

    - by holmes
    So I've been using EasyMock's class extension for a while now. All of a sudden I'm getting this exception, but only when I run the entire test suite: java.lang.IllegalStateException: 0 matchers expected, 1 recorded. at org.easymock.internal.ExpectedInvocation.createMissingMatchers(ExpectedInvocation.java:42) at org.easymock.internal.ExpectedInvocation.<init>(ExpectedInvocation.java:34) at org.easymock.internal.ExpectedInvocation.<init>(ExpectedInvocation.java:26) at org.easymock.internal.RecordState.invoke(RecordState.java:64) at org.easymock.internal.MockInvocationHandler.invoke(MockInvocationHandler.java:24) at org.easymock.internal.ObjectMethodsFilter.invoke(ObjectMethodsFilter.java:56) at org.easymock.classextension.internal.ClassProxyFactory$1.intercept(ClassProxyFactory.java:74) at com.protrade.soccersim.data.emulator.matrix.PositionCategoryMatrix$$EnhancerByCGLIB$$c5298a7.getPossession(<generated>) at com.protrade.soccersim.data.emulator.stats.team.PossessionCalculatorUnitTest.testDeterminePossessionHomeWin(PossessionCalculatorUnitTest.java:45) The code involved is this little beauty (trimmed a bit): @Before public void setUp() throws Exception { homeTeam = createMock( PositionCategoryMatrix.class ); awayTeam = createMock( PositionCategoryMatrix.class ); ... } @Test public void testDeterminePossessionHomeWin() { expect(homeTeam.getPossession()).andReturn( 0.15151515 ); expect(awayTeam.getPossession()).andReturn( 0.01515152 ); replay( homeTeam, awayTeam ); ... } The exception is being thrown on the first expect. And it really doesn't make sense. It says it's getting a matcher, but the method doesn't even take an argument. And odd enough it's only during test suites! I'm creating a new mock in the @Before, so it shouldn't be inheriting anything from somewhere else (not that some other method would have a matcher on it) So, any ideas?

    Read the article

  • pattern for the following condition in java

    - by zahir hussain
    hi i want to know how to write pattern.. for example : the word is "AboutGoogle AdWords Drive traffic and customers to your site. Pay through Cheque, Net Banking or Credit Card. Google Toolbar Add a search box to your browser. Google SMS To find out local information simply SMS to 54664. Gmail Free email with 7.2GB storage and less spam. Try Gmail today. Our ProductsHelp Help with Google Search, Services and ProductsGoogle Web Search Features Translation, I'm Feeling Lucky, CachedGoogle Services & Tools Toolbar, Google Web APIs, ButtonsGoogle Labs Ideas, Demos, ExperimentsFor Site OwnersAdvertising AdWords, AdSenseBusiness Solutions Google Search Appliance, Google Mini, WebSearchWebmaster Central One-stop shop for comprehensive info about how Google crawls and indexes websitesSubmit your content to Google Add your site, Google SitemapsOur CompanyPress Center News, Images, ZeitgeistJobs at Google Openings, Perks, CultureCorporate Info Company overview, Philosophy, Diversity, AddressesInvestor Relations Financial info, Corporate governanceMore GoogleContact Us FAQs, Feedback, NewsletterGoogle Logos Official Logos, Holiday Logos, Fan LogosGoogle Blog Insights to Google products and cultureGoogle Store Pens, Shirts, Lava lamps©2010 Google - Privacy Policy - Terms of Service" I have to search some word... for example "google insights" so how to write the code in java... i just write small code... check my code and answer my question... that code only use for find the search word, where is that. but i need to display some words front of search word and display some words rear of search workd... similar to google search... my code is Pattern p = Pattern.compile("(?i)(.*?)"+search+""); Matcher m = p.matcher(full); String title=""; while (m.find() == true) { title=m.group(1); System.out.println(title); } the full is orignal content, search s search word... thanks and advance

    Read the article

  • How to let the matcher to match the second invocation on mock?

    - by Alex Luya
    I have an interface like this public interface EventBus{ public void fireEvent(GwtEvent<?> event); } and test code(testng method) looks like this: @Test public void testFireEvent(){ EventBus mock=mock(EventBus.class); //when both Event1 and Event2 are subclasses of GwtEvent<?> mock.fireEvent(new Event1()); mock.fireEvent(new Event2()); //then verify(mock).fireEvent(argThat(new Event2Matcher())); } Event2Matcher looks like this: private class Event2Matcher extends ArgumentMatcher<Event2> { @Override public boolean matches(Object arg) { return ((Event2) arg).getSth==sth; } } But get an error indicating that: Event1 can't be cast to Event2 And obviously,the matcher matched the first invoking mock.fireEvent(new Event1()); So,the statement within matcher return ((Event2) arg).getSth==sth; Will throw out this exception.So the question is how to let verify(mock).fireEvent(argThat(new Event2Matcher())); to match the second invoking?

    Read the article

  • using itext how to extracta string in java

    - by user2455183
    I am finding the string in between 123 and 321 and making it as bold. For that I used the Pattern to get the string before 123, text between 123 and 321 and text after 321. Could anyone please help me get all the strings between 123 and 321. Pattern p = Pattern.compile("^.*?(123)"); Matcher m = p.matcher(meredithEditorialSectionSegment); while (m.find()) { String desc = m.group(); String segDesc = (desc.substring(0, desc.length() - 3)); segmentDesc.add(new Chunk(segDesc, sectionDescriptionFont)); } descBold = meredithEditorialSectionSegment.substring(meredithEditorialSectionSegment.indexOf("123") + 3); descBold = descBold.substring(0, descBold.indexOf("321")); segmentDesc.add(new Chunk(descBold, sectionDescriptionBoldFont)); Matcher matcher = Pattern.compile("(?<=321).*").matcher(meredithEditorialSectionSegment); matcher.find(); segmentDesc.add(new Chunk(matcher.group(), sectionDescriptionFont));

    Read the article

  • java.util.regex.Pattern matching the beginning of a String

    - by Pierre
    Hi all, Is it possible to know if a stream/string contains an input that could match a regular expression. For example String input="AA"; Pattern pat=Pattern.compile("AAAAAB"); Matcher matcher=pat.matcher(input); //<-- something here returning true ? or String input="BB"; Pattern pat=Pattern.compile("AAAAAB"); Matcher matcher=pat.matcher(input); //<-- something here returning false ? Thanks

    Read the article

  • What is the C# equivalent of java.util.regex?

    - by peter.murray.rust
    I am converting Java code to C# and need to replace the use of Java's regex. A typical use is import java.util.regex.Matcher; import java.util.regex.Pattern; //... String myString = "B12"; Pattern pattern = Pattern.compile("[A-Za-z](\\d+)"); Matcher matcher = Pattern.matcher(myString); String serial = (matcher.matches()) ? matcher.group(1) : null; which should extract a capture group from a matched target string. I'd be grateful for simple examples. EDIT: I have now added the C# equivalent of the code as an answer. EDIT: Here is a tutorial on the use of the actual expressions. EDIT: Here is a useful comparison of C# and Java (and Perl.)

    Read the article

  • Lookahead regex produces unexpected group

    - by Ivan Yatskevich
    I'm trying to extract a page name and query string from a URL which should not contain .html Here is an example code in Java: public class TestRegex { public static void main(String[] args) { Pattern pattern = Pattern.compile("/test/(((?!\\.html).)+)\\?(.+)"); Matcher matcher = pattern.matcher("/test/page?param=value"); System.out.println(matcher.matches()); System.out.println(matcher.group(1)); System.out.println(matcher.group(2)); } } By running this code one can get the following output: true page e What's wrong with my regex so the second group contains the letter e instead of param=value?

    Read the article

  • how to use a regex to search backwards effectively?

    - by Asaf
    hi, i'm searching forward in an array of strings with a regex, like this: for (int j = line; j < lines.length; j++) { if (lines[j] == null || lines[j].isEmpty()) { continue; } matcher = pattern.matcher(lines[j]); if (matcher.find(offset)) { offset = matcher.end(); line = j; System.out.println("found \""+matcher.group()+"\" at line "+line+" ["+matcher.start()+","+offset+"]"); return true; } offset = 0; } return false; note that in my implementation above i save the line and offset for continuous searches. anyway, now i want to search backwards from that [line,offset]. my question: is there a way to search backwards with a regex efficiently? if not, what could be an alternative? 10x, asaf :-) clarification: by backwards i mean finding the previous match. for example, say that i'm searching for "dana" in "dana nama? dana kama! lama dana kama?" and got to the 2nd match. if i do matcher.find() again, i'll search forward and get the 3rd match. but i want to seach backwards and get to the 1st match. the code above should then output something like: found "dana" at line 0 [0,3] // fwd found "dana" at line 0 [11,14] // fwd found "dana" at line 0 [0,3] // bwd

    Read the article

  • regex count in single match

    - by 01
    i want to check if string doesnt have more than 5 numbers, i can do it this way Matcher matcher = Pattern.compile("\\d").matcher(val); i = 0; while (matcher.find()) { i++; } However i would like to do it without while(because we are using regex validation framework). I want to be able to match strings like A2sad..3f,3,sdasad2..2

    Read the article

  • Java regex basic usage problem

    - by Ernelli
    The following code works: String str= "test with foo hoo"; Pattern pattern = Pattern.compile("foo"); Matcher matcher = pattern.matcher(str); if(matcher.find()) { ... } But this example does not: if(Pattern.matches("foo", str)) { ... } And neither this version: if(str.matches("foo")) { ... } In the real code, str is a chunk of text with multiple lines if that is treated differently by the matcher, also in the real code, replace will be used to replace a string of text. Anyway, it is strange that it works in the first version but not the other two versions.

    Read the article

  • Regex whitespace and special characters

    - by Sam R.
    I have this regular expression: [^\\s\"']+|\"([^\"]*)\"|'([^']*)' which works for splitting a string by white spaces, and anything within a quotation is not delimited. However, I notice that if I put in a string that starts with "" no matches are found. How would I correct this? For example, if I enter " test 2". I want it to match to [, test, 2] Note: using java to compile the regex, here is some code Pattern pattern = Pattern.compile("[^\\s\"']+|\"([^\"]*)\"|'([^']*)'"); Matcher matcher = pattern.matcher(SomeString); while (matcher.find()){ String temp = matcher.group(); //... Do something ... } Thanks.

    Read the article

1 2 3 4 5  | Next Page >