Regex for comma detection

Hi,
im trying to capture comma from a csv string, im unable to exclude the string having comma in between text part.
eg 1)
sample string-> 4,5656,123123,'this is sample text',''
expected regex output->4{color:#ff0000},{color}5656{color:#ff0000},{color}123123{color:#ff0000},{color}'this is sample text'{color:#ff0000},{color}''
eg2)
sample string-> 4,5656,123123,'this is, sample text',''
expected regex output->4{color:#ff0000},{color}5656{color:#ff0000},{color}123123{color:#ff0000},{color}'this is, sample text'{color:#ff0000},{color}''
In above example the text containing comma in between of single quote is excluded
Can anybody guide me through this(need regex for eg2)? Any kind of assistance would be priceless!!!

Encephalopathic wrote:
You may want to skip regex and look into using a Java csv parser which I heard exist in the public domain. I don't have any links but sourceforge and/or google can help.http://ostermiller.org/utils/CSV.html

Similar Messages

  • Look Up For Comma Separated Strings

    Hi,
    How to look up for comma separated string from livecycle forms manager ??
    Plz gimme an idea on this.
    Raghava Kumar V.S.S.

    Hi
    My point is that the more detailed you ask your question, the more likely you are to get an answer.
    Those of us who monitor these newsgroups also appreciate you doing as much of your own research as possible, before asking us for help - we're more likely to spend our own (personal and valuable) time helping you, if we know that you've spent your own time doing research, and you've still not been able to solve the problem.
    I look forward to your next question :-)
    Howard

  • Is any software available for face detection to unlock screen?

    is any software available for face detection to unlock screen?

    No. Third party software annot control the operating system.

  • java code for intrusion detection system

    hi
    how can i write a java code for intrusion detection system wireless network (steps)
    help please whith any documentation , exemples , name of packages thank you

    hi
    anyone have code source java projet of an IDS intrusion detection system for VANET and thank you

  • Regex for url pattern validation

    Hi,
    I am trying to find a regex for Url pattern validation that is not too restrictive.
    Please let me know, if anyone is using a pattern for their applications.
    Thanks
    Mayank Sharma

    are you talking about xml schema restriction?
    <xs:element name="url">
      <xs:simpleType>
       <xs:restriction base="xs:string">
        <xs:pattern value="(https?://)?[-\w.]+(:\d{2,5})?(/([\w/_.]*)?)?" />
       </xs:restriction>
      </xs:simpleType>
    </xs:element>

  • Regex for a URL

    How do I write a regex for the following URL. I am trying to write a regex rule in Oracle WebCache.
    /myserver.domain.com:7779/mapviewer/mcserver?format=PNG&mapcache=mvdemo.demo_map&mx=198&my=247&request=gettile&zoomlevel=3
    Thanks,

    I would start with a not so restrictiv expression.
    something like
    SQL> with testdata as (select '/myserver.domain.com:7779/mapviewer/mcserver?format=PNG&mapcache=mvdemo.demo_map&mx=198&my=247&request=gettile&zoomlevel=3' urlstring from dual union all
      2                    select '/myserver.domain.com:7779/mapviewer/mcserver?format=PNG&mapcache=mvdemo.demo_map&mx=200&my=300&request=gettile&zoomlevel=180' urlstring from dual union all
      3                    select '/myserver.domain.com:7779/mapviewer/mcserver?format=PNG&mapcache=mvdemo.demo_map&my=300&mx=200&request=gettile&zoomlevel=0' urlstring from dual union all
      4                    select '/myserver.domain.com:7779/mapviewer/mcserver?format=PNG&mapcache=mvdemo.demo_map&mx=100&my=200&request=gettile' urlstring from dual union all
      5                    select 'somethingelse' urlstring from dual)
      6  select urlstring
      7  from testdata
      8  where regexp_like(urlstring,'^/myserver.domain.com:7779/mapviewer/mcserver[?]format=[PNG|SVG].+[mapcache=mvdemo.demo_map].+[request=gettile]');
    URLSTRING
    /myserver.domain.com:7779/mapviewer/mcserver?format=PNG&mapcache=mvdemo.demo_map
    &mx=198&my=247&request=gettile&zoomlevel=3
    /myserver.domain.com:7779/mapviewer/mcserver?format=PNG&mapcache=mvdemo.demo_map
    &mx=200&my=300&request=gettile&zoomlevel=180
    /myserver.domain.com:7779/mapviewer/mcserver?format=PNG&mapcache=mvdemo.demo_map
    &my=300&mx=200&request=gettile&zoomlevel=0
    /myserver.domain.com:7779/mapviewer/mcserver?format=PNG&mapcache=mvdemo.demo_map
    &mx=100&my=200&request=gettile
    SQL> In this example the url needs to include the mapcache, format and request parameter.
    Edited by: Sven W. on Oct 29, 2008 7:23 PM

  • * JMF PlugIn Effect/Codec Filter for Motion Detection : Source Example *

    I have noticed some posts on here recently about reading a webcam�s pixel stream and as at least one example the processing of that data for robotics, or another for motion detection or tracking.
    This can mean a requirement for fast frame processing, setting the datasource framerate, and to implement as easily as possible; eg a simple JMF effect or codec plugin to set on the processor.
    I have a link as follows to some source and examples for such plugin effects, and some of you may find this interesting if not also useful.
    See an updated http://www.exactfutures.com/index02.htm for the new download. Enjoy.

    thanx Andy

  • Regex For Contractions/Possessives

    Hello,
    I'm trying to construct a regex for contractions and possessives.
    So, we want to validate strings like:
    'tis
    it's
    Travis'
    Ferdinand's
    However, I can't seem to get the regex to handle the apostrophe correctly...
    Here's what I have for regular contractions, (it's but not Travis' or 'tis)
    token.matches("[\\w]+'[\\w]+") What should I be doing differently?
    Thanks!
    Edited by: chhasx on Sep 1, 2009 2:42 PM

    You don't need the square brackets in this case. You shouldn't have + at the end of the second \w; there can be one or none, so it should be ?. Also it shouldn't be \w because it can only be "s". Also you're not covering the case "Travis's". Actually according to Strunk and White that's acceptable (preferred, IIRC) so maybe that's OK.
    You're not checking for "his", "her", "hers", or "its".
    This isn't internationalized either.

  • Regex for RDF parsing

    Hi.
    I need help with parsing a rdf-format input stream. I want to use regex for parsing.
    The stream looks like this:
    <?xml version="1.0" encoding="ISO-8859-1" ?><rdf:RDFxmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns="http://my.netscape.com/rdf/simple/0.9/"><channel> <title>heise online news</title><link>http://www.heise.de/newsticker/</link><description>Nachrichten aus der Welt des Computers</description></channel><item><title>Scharfe Regeln f?r Chinas Cybercafes</title><link>http://www.heise.de/newsticker/data/gr-12.10.02-004/</link></item>.........</item></rdf:RDF>
    The information i need is placed between the <item></item> tags.
    I have wrote following code to get all subsequences like "<item>...</item>":
    String rval = new String("");
    Pattern p = Pattern.compile("<item[ >](.*)</item>");
    Matcher m = p.matcher(retval);
    while (m.matches()) {
    rval = rval + m.group() + "<br>\n";
    But this loop only once and the output is one large String from the first "<item>" to the last "</item>" like "<item>......</item><br>\n". The <item>...</item> combos within are ignored. Maybe the regex must be change?
    Thanks for answer,
    sushiprinz

    You need to use the non-greedy star:Pattern p = Pattern.compile("<item>(.*?)</item>");Also, I think you want to use find() instead of matches().

  • Regex for URL Validation

    HI I am validating a field which takes a url as input from the user.So the url may contain http,https,ftp links or the user may specify the ip address.So can anyone please help me out to create a suitable regex for that.I just need to check the validness of link and not that it exists or not.

    here i have changed the regex as suggested by you but
    it returns true even for http://com.com@
    which is invalid.
    So it did not worked :-(It did not work, because you did not use it correct:
    public class Foo {
        private static boolean isValidUrl(String url) {
            return url.matches("(https?|ftp)://www\\.\\w+\\.\\w+");
        public static void main(String[] args) {
            String[] urls = {
                    "http://com.com@",
                    "http://www.com.com",
                    "http://www.com.nl",
                    "http://www.com.co.uk",
                    "http://www.com"
            for(String url : urls) {
                System.out.println(url+" valid? "+isValidUrl(url));
    }

  • Regex for URL Expression

    I am not a programmer, but I have to write a rule for CACHING the following URL that is being generated with "GET_QUERYSTRING".
    /myserver.domain.com:7779/mapviewer/mcserver?format=PNG&mapcache=mvdemo.demo_map&mx=198&my=247&request=gettile&zoomlevel=3
    As you can see, I would like to cache all the PNG map tiles, but I don't know how to come up with Regular Expression (regex) for the above URL.
    Thanks,

    are you talking about xml schema restriction?
    <xs:element name="url">
      <xs:simpleType>
       <xs:restriction base="xs:string">
        <xs:pattern value="(https?://)?[-\w.]+(:\d{2,5})?(/([\w/_.]*)?)?" />
       </xs:restriction>
      </xs:simpleType>
    </xs:element>

  • Custom Document for Comma Separated Values in a JTextField

    Hi,
    I tried to create a custom structured Document implementation for comma separated values (on one line) in a JTextField:
    I want to have one LeafElement for each value (to store as an attribute the Object associated with this value). So, if I plug a DocumentListener to the JTextField, I can easily see which value(s) have been added/removed (see ElementChange).
    I used the PlainDocument implementation as a starting point and replaced the logic related to the '\n' character by the ',' (see #insertUpdate).
    Then I realized that the View must be customized too. So I created a View with a custom #paint method to draw each LeafElement on the same line.
    But, now, I try to fix the ElementChange returned by the #insertUpdate and #removeUpdate methods.
    Indeed, I played with a JTextArea with two lines "Bart\nisa" and plugged a debugging DocumentListener.
    And the event I get when I type 'L' before "isa" is really strange:
    - Two elements removed,
    - Two elements added.
    In the PlainDocument#insertUpdate, the code updates the 'offset' but I don't understand the logic behind.
    Could you explain me why I got this result?
    Could you give me an hint?
    Best Regards,
    El Barto.

    When you say the offset gets updated, I assume you're talking about this bit:
         int offset = chng.getOffset();
         int length = chng.getLength();
         if (offset > 0) {
           offset -= 1;
           length += 1;
         } The result is that, if a character is added at the very beginning or end of a line, the edit gets treated as a multi-line edit, which means the LeafElements on either side of the edit get removed and reconstructed. I discovered this behavior a few years ago, and I never have figured out what purpose it serves. I think you'll just have to try overriding the method to eliminate that behavior, and see what happens.

  • What is the Account posting for Commissions

    Hi All,
    If there is any account posting done for commissions during the transactions like A/R Invoice?
    If yes, then  please tell me about the journal in detail and accounts in which it is posted.
    Thanx & Regards
    Sibasish

    Commissions can be defined for a sales employee, an item, or a customer. The commission is determined when a sales document is entered and saved for all the rows in the document. The Commission Groups define the commissions that are given internally to the sales employees. The commissions are calculated in a report, (Tools -> Queries ->System Queries -> SP Commission by Invoices in Posting Date Cross-Section) and are not posted to any accounts.

  • Write REGEX for a string pattern

    Hi All,
    I am new to using regular expression and writing the patterns, I am looking to write a pattern for below formats and do a FIND REGEX:
    A123456-01-123456789-123   and A123456-01-123456789-ABC
    DATA: regex TYPE REF TO cl_abap_regex,
          res   TYPE        match_result_tab,
          text  TYPE        string.
    CREATE OBJECT regex
        EXPORTING pattern      = '\(.\)\1'
                  simple_regex = 'X'
    FIND ALL OCCURRENCES OF REGEX regex IN text RESULTS res.
    could you help me write the pattern to check if user has entered string in formats A123456-01-123456789-123   and A123456-01-123456789-ABC
    Thank you
    Depp

    Hi Manish,
    First of all sorry for getting back so late..was stuck with project delivery...and Thank you for your solution. Only one scenario failed i.e., I didn't mention that the value 01 in the examples, is constant in strings A123456-01-123456789-123   and A123456-01-123456789-ABC.
    which means it has to be always 01 any other value than 01 the sy-subrc should not be zero.
    I will also be thankful if you could share me the document(s) which help us write the above patterns( '^\w\d{6}-\d{2}-\d{9}-\d{3}$' ; '^\w\d{6}-\d{2}-\d{9}-\w{3}$' ).
    In the meanwhile I will also do some R&D with your reply to solve the failed scenario.
    Regards,
    Depp

  • How to create a regex for the question mark as a literal?

    I get:
    Exception in thread "main" java.util.regex.PatternSyntaxException: Dangling meta character '?' near index 3
    (?)?For
    (\p{Punct})?
    and (\\?)?
    and (\\'?')?

    simpatico_gabriele wrote:
    I get:
    Exception in thread "main" java.util.regex.PatternSyntaxException: Dangling meta character '?' near index 3
    (?)?For
    (\p{Punct})?
    and (\\?)?
    and (\\'?')?Sorry but, as Darryl says, you need to explain your problem a bit better because the patterns
            Pattern p0 = Pattern.compile("(\\p{Punct})?");
            Pattern p1 = Pattern.compile("(\\?)?");
            Pattern p2 = Pattern.compile("(\\'?')?");all compile and run without any exception.

Maybe you are looking for

  • Adobe Bridge CS4 crashes when trying to refresh preview for PDF output

    Ever since installing ML, I cannot create contact sheets in Adobe Bridge CS4, which I was able to do before installing ML. As soon as I press "Refresh Preview," Bridge crashes with the following report (the same thing happens if I just try to Save th

  • Links in emails borked

    The links in emails for 'reply/view' this thread, as well as 'you can't start a new thread over email' are both broken.

  • Business Catalyst Problem Using API to insert/update

    Hi, I am trying to use the API to insert/update products. But have been getting the following error in the response. HTTP/1.1 100 Continue HTTP/1.1 500 Internal Server Error Cache-Control: private Content-Length: 370 Content-Type: text/xml; charset=u

  • Shopping cart source of supply

    Hi experts, We are implementing SRM 7.0 in Extended Classic Scenario (SAPKIBKV06). I need an expert advice in shopping cart SOS assignment. We have free text Central Contract in our scenario. Our requirement is that when users create free text shoppi

  • How to develop java webservice in jDeveloper

    Hi, iam new to web services. iwant to develop the webservice in jDeveloper. i am also new to jDeveloper. ? can you please give me the steps to develop the webservices? and also give me the suggestion which tool i can use? if any body having the sampl