Problem in creating a Regular Expression with gnu

Hi All,
iam trying to create a regular expression using gnu package api..
gnu.regex.RE;
i need to validate the browser's(MSIE) userAgent through my regular expression
userAgent is like :First one ==> Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
i wrote an regular expression like this:
Mozilla.*(.*)\\s*(.*)compatible;\\s*MSIE(.*)\\s*(.*)([0-9]\\.[0-9])(.*);\\s*(.*)Windows(.*)\\s*NT(.*)\\s*5.0(.*)
Actaully this is validating my userAgent and returns true, my problem is, it is returning true if userAgent is having more words at the end after Windows NT 5.0 like Second One ==> Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) Testing
i want the regularExpression pattern to validate the First one and return true for it, and has to return false for the Second one..
my code is:
import gnu.regexp.*;
import gnu.regexp.REException;
public class TestRegexp
public static boolean getUserAgentDetails(String userAgent)
     boolean isvalid = false;
     RE regexp = new RE("Mozilla.*(.*)\\s*(.*)compatible;\\s*MSIE(.*)\\s*(.*)([0-9]\\.[0-9])(.*);\\s*(.*)Windows(.*)\\s*NT(.*)\\s*5.0(.*)");
     isvalid = regexp.isMatch(userAgent);
     return isvalid;
public static void main(String a[])
     String userAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)";
     boolean regoutput = getUserAgentDetails(userAgent);
     System.out.println("***** regoutput is ****** " + regoutput);
}please help me in solving this..
Thanks in Advance..
thanx,
krishna

Ofcourse, i can do comparision with simple string matching..
but problem is the userAgent that i want to support is for all the MSIE versions ranging from 5.0 onwards, so there will the version difference of IE like MSIE 6.0..! or MSIE 5.5 some thing like that..
any ways i will try with StringTokenizer once..!
seems that will do my work..
Thanks,
krishna

Similar Messages

  • Problem creating a regular expression

    Hi Everyone
    I am trying to create a regular expression for validating a password string for the following given rule -
    It must contain atleast any two of following 4 classes of characters -
    1. lowercase letters.. a - z
    2. uppercase letters.. A - Z
    3. digits.. 0 - 9
    4. Special characters.. !@#$%^&*()/?><
    I m having a hard time creating such regular expression. I will really appreciate if someone can help me with this.

    [http://google.com/search?q=regular+expression+password+validation+site:forums.sun.com]

  • Regular Expressions with Call Policy on VCSe

    Hi Guys,
      I am working on firming up the call policy on my VCS Expressway to try to better intercept the SIP spam requests it is getting from internet ip numbers. Right now those spam requets are getting rejected by the loop detection but I want to intercept them before they even do a search on the Expressway. It seems that the call policy rules I create without regular expressions are functioning fine but I don't think I have the syntax correct for the regular expressions.
    The goal of this rule is to reject any incoming SIP request that has a destination alias format of 7 to 17 digits followed by an @VCSe_IP. so for example it would reject the following attempts: 0123456@VCSe_IP and 0123456789101112@VCSe_IP with one rule.
    The policy I created is this: source pattern: unauthenticated user, Destination pattern: \d{7,17}@xx\.xx\.xx\.xx (where xx is the individual octets of the VCSe IP address), Action: reject  
    However the above policy does not seem to be rejecting the calls before they do a search. I have checked the above expression with the check pattern tool on the VCSe and it comes up with a sucessful match when I try the destination alias of a request that made it through, hence my confusion. Any help you guys could provide would be appreciated.
    Thanks,
    Steven                

    Steven,
    Default Zone access rules do not relate to this at all and you can keep those set to 'No'.
    How exactly are you placing the test calls when attempting to verify this?
    I created the following CPL rule on my X7 VCS (With 10.10.10.10 being the IP address of my VCS):
    Source pattern:
    Destination pattern: \d{7,17}@10\.10\.10\.10
    Action: Reject
    I then proceeded with placing a SIP call from an unregistered C20, calling the URI '[email protected]' while running a diagnostics log on my VCS with Network log level set to 'DEBUG', and captured the following in that log:
    Incoming INVITE:
    2013-02-22T16:03:36+01:00 vcs02 tvcs: UTCTime="2013-02-22 15:03:36,598" Module="network.sip" Level="INFO":  Src-ip="10.x.x.x"  Src-port="5060"   Detail="Receive Request Method=INVITE, Request-URI=sip:[email protected], Call-ID=9dd19ad75b1063ecf716461b149e9e2a"
    2013-02-22T16:03:36+01:00 vcs02 tvcs: UTCTime="2013-02-22 15:03:36,598" Module="network.sip" Level="DEBUG":  Src-ip="10.x.x.x"  Src-port="5060"
    SIPMSG:
    |INVITE sip:[email protected] SIP/2.0
    Call processing logic, showing CPL matching:
    2013-02-22T16:03:36+01:00 vcs02 tvcs: Event="Search Attempted" Service="SIP" Src-alias-type="SIP" Src-alias="10.x.x.x" Dst-alias-type="SIP" Dst-alias="sip:[email protected]" Call-serial-number="0886391c-7d01-11e2-adf5-0050569a08fd" Tag="08863aac-7d01-11e2-bd2e-0050569a08fd" Detail="searchtype:INVITE" Level="1" UTCTime="2013-02-22 15:03:36,601"
    2013-02-22T16:03:36+01:00 vcs02 tvcs: Event="Call Attempted" Service="SIP" Src-ip="10.x.x.x" Src-port="5060" Src-alias-type="SIP" Src-alias="sip:10.x.x.x" Dst-alias-type="SIP" Dst-alias="sip:[email protected]" Call-serial-number="0886391c-7d01-11e2-adf5-0050569a08fd" Tag="08863aac-7d01-11e2-bd2e-0050569a08fd" Protocol="UDP" Auth="NO" Level="1" UTCTime="2013-02-22 15:03:36,601"
    2013-02-22T16:03:36+01:00 vcs02 tvcs: UTCTime="2013-02-22 15:03:36,602" Module="network.cpl" Level="DEBUG":  Remote-ip="10.x.x.x"  Remote-port="5060"   Detail="CPL: "
    2013-02-22T16:03:36+01:00 vcs02 tvcs: UTCTime="2013-02-22 15:03:36,602" Module="network.cpl" Level="DEBUG":  Remote-ip="10.x.x.x"  Remote-port="5060"   Detail="CPL:   "
    2013-02-22T16:03:36+01:00 vcs02 tvcs: UTCTime="2013-02-22 15:03:36,602" Module="network.cpl" Level="DEBUG":  Remote-ip="10.x.x.x"  Remote-port="5060"   Detail="CPL: matched "
    2013-02-22T16:03:36+01:00 vcs02 tvcs: UTCTime="2013-02-22 15:03:36,602" Module="network.cpl" Level="DEBUG":  Remote-ip="10.x.x.x"  Remote-port="5060"   Detail="CPL: "
    VCS responds to INVITE with 403 Forbidden:
    2013-02-22T16:03:36+01:00 vcs02 tvcs: UTCTime="2013-02-22 15:03:36,616" Module="network.sip" Level="DEBUG":  Dst-ip="10.x.x.x"  Dst-port="5060"
    SIPMSG:
    |SIP/2.0 403 Forbidden
    As you can see, on my VCS everything seems to work as expected. I'd recommend you capture a similar diagnostics log on your own VCS to check what is different in your test call compared to the output above.

  • Writing Regular Expression with a character ^, too difficult

    I want to change "^1Mandrake ^3Style ^4DM" this sentence to "Mandrake Style DM".
    (^ with number means color code)
    So..I used String.replaceAll() method with regular expression.
    But however hard I try, I cant find any solution for this.
    In php I could use \^ as a ^ character, but java dosnt support \^.
    How can I solve this problem?

    Use \\^ in your regex (you have to escape the slash, too).

  • Problem in creating client side PDF with image using flex and AlivePD

    I need a favor I am creating client side PDF with image using flex and AlivePDF for a web based application. Images have been generated on that pdf but it is creating problem for large size images as half of the image disappeared from that pdf.I am taking the image inside a canvas . How do i control my images so that they come fit on that pdf file for any image size that i take.
    Thanks in advance
    Atishay

    I am having a similar and more serious problem. It takes a
    long time to execute, but even attaching a small image balloons the
    pdf to 6MB plus. After a few images it gets up to 20MB. These are
    100k jpeg files being attached. The resulting PDF is too large to
    email or process effectively. Does anyone know how to reduce
    size/processing?

  • Problem when creating a sales order with reference by BAPI

    I am facing one problem when creating Sales Order.
    <b>The scenario is like this while creating SO With reference to an Order type, a new SO will be automatically created with a diff order Type</b>.
    I am using "BAPI_SALESORDER_CREATEFROMDAT2".
    I am calling this BAPI in USEREXIT_REFRESH_DOCUMENT.
    Am I using the right exit to call this Bapi ?
    <b>Problems are like :
    1. Ref Sales Order creating without Sales Unit .
    2. "Object Status does not exist" error msg is coming for Header and Item level(when clicking the status tab and then object status pushbutton).</b> But if testing the bapi from SE37 in test sequence....no such problem persists.
    As for example in case of sales unit,in the debugging mode i have seen that BAPI uses a perform to fill the values in the VBAP structure.But after that when it come back to the main program VBAP remains blank.This ocuurs when the BAPI is called from the exit whereas  if tested from SE37, VBAP retains the value.
    Can u suggest in this ? This is very very urgent............
    Thx in Adv.........................

    Thanks........
    Your suggestion was a great help to me.I have used a custom FM and called it in <b>starting new task</b>.
    Since i am a university fresher working in SAP for nearly 1 year.....can you please explain me the difference between <b>in update task</b> and <b>starting new task</b>.Why the problem was occuring for which you have suggested to call a custom function module.
    what is V1 update and V2 update?Is it attached with asynchronous ans synchronous update.It would be a great help to me if you kindly clear my confusions....
    thanks in advance.

  • Regular expressions with boolean connectives (AND, OR, NOT) in Java?

    I'd like to use regular expression patterns that are made up of simple regex patterns connected via AND, OR, or NOT operators, in order to do some keyword-style pattern matching.
    A pattern could look like this:
    (.*Is there.*) && (.*library.*) && !((.*badword.*) || (^$))
    Is there any Java regex library that allows these operators?
    I know that in principle these operators should be available, since Regular languages are closed under union, intersection, and complement.

    AND is implicit,
    xy -- means x AND yThat's not what I need, though, since this is just
    concatenation of a regex.
    Thus, /xy/ would not match the string "a y a x",
    because y precedes x.So it has to contain both x and y, but they could be
    in any order?
    You can't do that easily or generally.
    "x.*y|y.*x" wouldll work here, but obviously
    it will get ugly factorially fast as you add more
    terms.You got that right: AND means the regex operands can appear in any order.
    That's why I'm looking for some regex library that does all this ugly work for me. Again, from a theoretical point of view, it IS possible to express the described semantics of AND with regular expressions, although they will get rather obfuscated.
    Unless somebody has done something similar in java (e.g., for C++, there's Ragel: http://www.cs.queensu.ca/~thurston/ragel/) , I will probably use some finite-state-machine libraries and compile the complex regex's into automata (which can be minimized using well-defined operations on FSMs).
    >
    You'd probably just be better off doing multiple
    calls to matches() or whatever. Yes, that's another possibility, do the boolean operators in Java itself.
    Of course, if you
    really are just looking for literals, then you can
    just use str.contains(a) && !str.contains(b) &&
    (str.contains(c) || str.contains(d)). You don't
    seem to need regex--at least not from your example.OK, bad example, I do have "real" regexp's in there :)

  • Regular expressions with multi character separator

    I have data like the
    where |`| is the separator for distinguishing two fields of data. I am having trouble writing a regular expression to display the data correctly.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> declare
      2  l_string varchar2 (200) :='123` 456 |`|789 10 here|`||223|`|5434|`}22|`|yes';
      3  v varchar2(40);
      4  begin
      5  v:=regexp_substr(l_string, '[^(|`|)]+', 1, 1);
      6  dbms_output.put_line(v);
      7  v:=regexp_substr(l_string, '[^(|`|)]+', 1, 2);
      8  dbms_output.put_line(v);
      9  v:=regexp_substr(l_string, '[^(|`|)]+', 1, 3);
    10  dbms_output.put_line(v);
    11  v:=regexp_substr(l_string, '[^(|`|)]+', 1, 4);
    12  dbms_output.put_line(v);
    13  v:=regexp_substr(l_string, '[^(|`|)]+', 1, 5);
    14  dbms_output.put_line(v);
    15  end;
    16  /
    123
    456
    789 10 here
    223
    5434I need it to display
    123` 456
    789 10 here
    |223
    5434|`}22
    yesI am not sure how to handle multi character separators in data using reg expressions
    Edited by: Clearance 6`- 8`` on Apr 1, 2011 3:35 PM
    Edited by: Clearance 6`- 8`` on Apr 1, 2011 3:37 PM

    Hi,
    Actually, using non-greedy matching, you can do what you want with regular expressions:
    VARIABLE     l_string     VARCHAR2 (100)
    EXEC  :l_string := '123` 456 |`|789 10 here|`||223|`|5434|`}22|`|yes'
    SELECT     LEVEL
    ,     REPLACE ( REGEXP_SUBSTR ( '|`|' || REPLACE ( :l_string
                                     , '|`|'
                                      , '|`||`|'
                                     ) || '|`|'
                        , '\|`\|.*?\|`\|'
                        , 1
                        , LEVEL
               , '|`|'
               )     AS ITEM
    FROM     dual
    CONNECT BY     LEVEL     <= 7
    ;Output:
    LEVEL ITEM
        1 123` 456
        2 789 10 here
        3 |223
        4 5434|`}22
        5 yes
        6
        7Here's how it works:
    The pattern
    ~.*?~is non-greedy ; it matches the smallest possible string that begins and ends with a '~'. So
    REGEXP_SUBSTR ('~SHALL~I~COMPARE~THEE~', '~.*?~', 1, 1) returns '~SHALL~'. However,
    REGEXP_SUBSTR ('~SHALL~I~COMPARE~THEE~', '~.*?~', 1, 2) returns '~COMPARE~'. Why not '~I~'? Because the '~' between 'SHALL' and 'I' was part of the 1st pattern, so it can't be part of the 2nd pattern. So the first thing we have to do is double the delimiters; that's what the inner REPLACE does. The we add delimiters to the beginning and end of the list. Once we've done prepared the string like that, we can use the non-greedy REGEXP_SUBSTR to bring back the delimited items, with a delimiter at either end. We don't want those delimiters, so the outer REPLACE removes them.
    I'm not sure this is any better than Sri's solution.

  • Regular Expressions with Java Regex

    Hi,
    I'm playing around with regex and there's something I can't get to work. What I need, is to capture words between 2 other words and the words captured has to be higher than 5 characters, so for example:
    Pattern "Just testing on something with regular expressions" and suppose I'll try to match all the words between "testing" and "regular", then only the word "something" should come out because "on" and "with" are not larger than 5 chars.
    Now I'm quite new to regexps and I know that ((?<=\btesting\b).*(?=\bregular\b)) will return " on something with "
    But I can't seem to come up with an expression that would only output the word "something". I've tried a few expressions like ((?<=\btesting\b)((?:[\s\w{1,3}])*(\b\w{4,}\b)*(?:[\s\w{1,3}])*)*(?=\bregular\b)) which also returns " on something with " The others I tried would either return the whole " on something with " or return "Not Found!"
    Does anyone have a tip for me? I'm well aware that it's not too hard to do something like this in Java, but I'm really looking to study regular expressions and would like to accomplish this using a regular expression.
    The Java program I use is the following:
    C:\Program Files\Java\jdk1.5.0_16\bin>java RegexTest "((?<=\btesting\b).*(?=\bregular\b))" "Just testing on something with regular expressions"
    public class RegexTest {
         public static void main(String[] args) {
              Pattern RegexCompile = Pattern.compile(args[0]);
              Matcher m = RegexCompile.matcher(args[1]);
              boolean found = m.find(); // Perhaps there's another function to find () that would do the job?
              if (found)
              System.out.println(m.group()); // Perhaps group() is not the right function for this case?
              else
              System.out.println("Not Found!");
    Edited by: dli2k3 on Sep 19, 2008 11:32 AM
    Edited by: dli2k3 on Sep 19, 2008 11:33 AM

    You're talking about a two-stage operation: find everything between those two words, then filter out anything that's less than five letters long. There's no single regex that will accomplish all that in one step.
    By the way, please use &#x7B;code} tags when you post source code.

  • Regular expressions with dates and multiple matches

    I am currently attempting to automate modifying start and end dates within a .config file via powershell but I am having issues identifying the regular expression for the end date section since both are on the same line in the file. Below is the string that
    I want to change.
    Sometimes the dates are blank and sometimes the dates are filled in.
    Dates are always in the same format (yyyy-MM-dd hh:mm).
    I also want to note that there are multiple instances of 'StartDate="" EndDate=""' for other applications throughout the same config file so I cannot limit the expression to not include the App name. 
    I do not want to limit the search to a line number since there are instances where admins will add an extra space in the config file that may throw off the line number.
    I want to replace the dates or lack there of in their respective spots on the line below via powershell:
     <App name="TestApp" StartDate="2012-03-22 13:30" EndDate="">
    I am successfully able to use 
    $startRegex = '(?<=<App name="TestApp" StartDate=")([^"]*)'
    to replace the StartDate but I can't seem to single out the EndDate with regular expression. What expression can I use to have it ignore what is in the quotations after StartDate and only pay attention to the EndDate value?
    Below is a snippet: 
    $path = d:\inetpub\website\app.config
    $startRegex = '(?<=<App name="TestApp" StartDate=")([^"]*)'
    $starttime = (get-date).ToString("yyyy-MM-dd hh:mm")
    (gc $path) -replace $startregex, $starttime | set-content $path
    I want to accomplish the same for EndDate.
    Thanks in advance!

    If you do this with XML it will be painless and less prone to error.
    $n=$xml.SelectSingleNode('//App[@name="TestApp"]')
    $n.StartDate=$newstartdate
    $n.EndDate=$newenddate
    $xml.Save($filename)
    \_(ツ)_/

  • Regular Expression with comma and encapsulated charaters

    Would appreciate some help. Looking for a regular expression to remove comma's from encapsulated text as follows
    For example
    - Input
    1,"This is a string, need to remove the comma",Another text string,10
    - Required output
    1,"This is a string; need to remove the comma",Another text string,10
    Have tried to use the REGEXP_REPLACE but could not grasp the pattern matching.
    Thanks John

    John Heaton wrote:
    Thanks for the solution,this works great for a single field encapsulated by " and containing ,. I am parsing several different file definitions so it would need to cascade through the string for a undetermined number of times and replace all occurrences. Then try (performance-wise) MODEL solution:
    {code}
    with t as (
    select '1,"This is a string, need to remove the comma",Another text string,10' txt from dual union all
    select '1,"remove this comma,",Another text string,10,"remove this comma,",xxx,"remove this comma,",11' txt from dual
    select txt_original,
    txt
    from t
    model
    partition by(row_number() over(order by 1) p)
    dimension by(1 rn)
    measures(txt txt_original,txt,0 quote)
    rules
    iterate(
    1e9
    until(
    iteration_number + 1 = length(txt[1])
    quote[1] = case substr(txt[1],iteration_number + 1,1)
    when '"' then quote[1] + 1
    else quote[1]
    end,
    txt[1] = case substr(txt[1],iteration_number + 1,1)
    when ',' then case mod(quote[1],2)
    when 1 then substr(txt[1],1,iteration_number) || ';' || substr(txt[1],iteration_number + 2)
    else txt[1]
    end
    else txt[1]
    end
    TXT_ORIGINAL TXT
    1,"This is a string, need to remove the comma",Another text string,10 1,"This is a string; need to remove the comma",Another text string,10
    1,"remove this comma,",Another text string,10,"remove this comma,",xxx,"remove this comma,",11 1,"remove this comma;",Another text string,10,"remove this comma;",xxx,"remove this comma;",11
    SQL>
    SY.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Regular expression with delimited string

    Hi,
    I'm trying extract all characters in a string (as word or words) which is delimited by ' -- '
    Been playing around with regular expression and got as far as this;
    with t_vw
    as (select 'hello -- world' txt from dual
    union all
    select 'hello-world' from dual
    union all
    select 'hello' from dual
    union all
    select 'hello -- world -- bye' from dual
    union all
    select 'hello--worldbye' from dual
    select txt, regexp_substr(txt,'[^ -- ]+',1,1) word1,
    regexp_substr(txt,'[^ -- ]+',1,2) word2,
    regexp_substr(txt,'[^ -- ]+',1,3) word3
    from t_vw;
    It's returning;
    "TXT","WORD1","WORD2","WORD3"
    "hello -- world" "hello","world",""
    "hello-world"          "hello","world",""
    "hello"               "hello","",""
    "hello -- world -- bye"     "hello","world","bye"
    "hello--worldbye"      "hello","worldbye",""
    So it seems to work in all cases apart from when there are no spaces before/after "--".
    Any ideas?

    Please enclose your code in *{noformat}{noformat}* tags to preserve your formatting and to prevent the forum software from mangling your regular expressions.
    Also, you've given your input and show the output that you are getting, but I don't know what your issue is.  If you could include the desired output and explain how it differs from what you are getting so far that would help.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Replace: regular expression with argument

    Hello.
    New to jdeveloper, I'm trying to use its Replace-facility. Problem is: how to refer to matched groups in replacement string?
    I've tried "public void set([\w(]*)" as argument, how then to refer to the match ([\w(]*) ?
    Using $1 just gives the literal $1.
    (This site uses $1, $2 etc for java regular expression arguments http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=523)
    Thanks in advance.
    Sjur

    Strangely enough nor \1, \2 or $1, $2 works on "replace in files". On "replace" \1, \2 etc works. Bug or feature?

  • Regular expression with newline in clob

    I have a clob that used end of line as chr(10).
    But if chr(10) comes in a line enclosed by quotes it needs to be skipped and be replaced by nothing.
    So the question is almost like this thread
    Regular expression
    But instead of looking for ',' I am looking for chr(10) between quotes.
    If I use the regular expression in the above forum, I donot get the same result....
    Any ideas?
    Thank you

    BTW, you can create your own function, e.g.:
    SQL> drop table t;
    Table dropped
    SQL>
    SQL> create table t (str clob);
    Table created
    SQL> insert into t values('John'||CHR(10)||'Doe'||CHR(10)||'"$85'||CHR(10)||'256"'||CHR(10)||'Programmer'||CHR(10)||'"$42'||CHR(10)||'857"');
    1 row inserted
    SQL> insert into t values('John,Doe,"$85,256",Programmer,"$42,857"');
    1 row inserted
    SQL> commit;
    Commit complete
    SQL> select rownum, str from t;
        ROWNUM STR
             1 John
               Doe
               "$85
               256"
               Programmer
               "$42
               857"
             2 John,Doe,"$85,256",Programmer,"$42,857"
    SQL>
    SQL> create or replace function selective_replace(p_str    clob,
      2                                               p_border varchar2,
      3                                               p_sign   varchar2) return clob is
      4    l_str      clob := p_str;
      5    l_str_part clob;
      6    l_count    number := 0;
      7  begin
      8    loop
      9      l_count := l_count + 1;
    10      exit when regexp_instr(l_str, p_border||'[^'||p_border||']*'||p_border, 1, l_count)=0;
    11      l_str_part := regexp_substr(l_str,p_border||'[^'||p_border||']*'||p_border, 1, l_count);
    12      if instr(l_str_part,p_sign)>0
    13      then
    14       l_str_part := replace(l_str_part, p_sign);
    15       l_str := regexp_replace(l_str, p_border||'[^'||p_border||']*'||p_border, l_str_part, 1, l_count);
    16      end if;
    17    end loop;
    18    return(l_str);
    19  end;
    20  /
    Function created
    SQL> select str, selective_replace(str,'"',CHR(10)) new_str from t;
    STR                                                                              NEW_STR
    John                                                                             John
    Doe                                                                              Doe
    "$85                                                                             "$85256"
    256"                                                                             Programmer
    Programmer                                                                       "$42857"
    "$42                                                                            
    857"                                                                            
    John,Doe,"$85,256",Programmer,"$42,857"                                          John,Doe,"$85,256",Programmer,"$42,857"
    SQL> select str, selective_replace(str,'"',',') new_str from t;
    STR                                                                              NEW_STR
    John                                                                             John
    Doe                                                                              Doe
    "$85                                                                             "$85
    256"                                                                             256"
    Programmer                                                                       Programmer
    "$42                                                                             "$42
    857"                                                                             857"
    John,Doe,"$85,256",Programmer,"$42,857"                                          John,Doe,"$85256",Programmer,"$42857"
    SQL>

  • PROBLEM IN CREATING A REGUALR EXPRESSION-VERY VERY URGENT.

    I WANT TO CREATE A REGUALAR EXPRESSION THAT WILL CHECK WHETHER THE FIRST AND THE LAST CHARACTER OF A STRING CONTAIN ANY SPECIAL CHARACTERS LIKE #,!,@ .
    EX- IF I GIVE THE INPUT "#java#", it will give me error,
    whereas IF I GIVE THE INPUT "java", it will not give me error.
    CAN ANYBODY PLZ HELP ME OUT WITH THE REQUIRED CODE.

    This guy's been shouting questions at us for over a month now. We should stop making fun of him and start helping him:
    import java.awt.*;
    import java.awt.event.*;
    public class StopShouting {
        public static void main(String[] args) {
            Toolkit kit = Toolkit.getDefaultToolkit();
            kit.setLockingKeyState(KeyEvent.VK_CAPS_LOCK, false);
    }

Maybe you are looking for

  • Access to itunes stores in multiple countries on same Apple ID

    I have billing address both in the UK and USA. How do I set up my itunes account so I can buy from both itunes stores?

  • How map a specific exception in my web.xml

    Hi all, i got a servlet that instantiates a JavaBean which has all the code to connect and get some data from my database, if some error ocurrs the JavaBean returns an string message which was an exception what i want is to get the error exception to

  • Apple apps quit and won't reopen

    Hello people. I've been having this issue since upgrading to Yosemite. Basically the MBP (2010 i7 quad) will work fine, then an apple app will quit and wipe all the apple apps out - Safari, Mail, Message & Facetime, App Store, About this Mac, Reminde

  • I am unable to charge my iphone4 . charging sign doesnt show

    i had kept my iphone4 on charging . in the morning i used it . then suddenly it got off and is not getting charged after connecting to charger . also not showing the charging sign

  • Onscreen keyboard - word completion

    maybe i am missing something, but I can't figure out how to use word completion using the onscreen keyboard. the word appears but I don't know how to select it...... maybe I am dumb? i have tried everything. searched the manual and the discussion thr