Regular expression - Replace not like

Hi All,
Is there a regexp pattern to replace anything other than 'oracle' from the below string.
"oracle sdsd oracle xyd fgh oracle idmdh asasas trtrt"
The result will be "oracleoracleoracle"
If I want to write like regexp_replace('oracle sdsd oracle xyd fgh oracle idmdh asasas trtrt',<pattern>), what should be the pattern?
I know how to get the result by nesting regexp and other functions.
But is there any single pattern for this?
Thanks in advance.
Note; This is not a business requirement, trying to learn regexp..

884476 wrote:
Could you please explain what does that pattern mean? We can look at your string as a sequence of substrings where each substring is set of characters (part A) followed by word oracle or, in last substring, by end-of-line (part B). Each of such substrings be want to replace with part B thus removing part A.
Dot (.) means any character. Asterisk (*) means repeated 0 or more times. This is our part A (I'll get back to ? later). Pipe (|) means OR. Dollar sigh ($) means end-of-line. Parenthesis mean grouping. So ((oracle)|$) means string oracle or end-of line. This is our part B. Now back to question mark. By default Oracle regular expressions are "greedy". We say any character repeated any number of times followed by word oracle. Since word oracle itself matched definition of any character repeated any number of times (6 in this case) regexp will match it that way that it will be from the beginning of the string to last occurrence of word oracle - that's why it is called "greedy". Question mark (?) tells regexp not to use greedy matching, therefore '.*?oracle' will stop at first occurrence of word oracle. Now replacement string. Notation \1 is grouping backreference. Group 1 is ((oracle)|$) and, as I already noted, means string oracle or end-of line (whichever was found).
SY.

Similar Messages

  • Regular Expression replacement not working

    I am trying to use a regular expression to replace non-ascii characters on a file, and I'm afraid I've reached the end of my regex knowledge. 
    Here is the specific code
    'Set the Regular Expression paramaters
    Set RegEx = CreateObject("VBScript.Regexp")
    RegEx.Global = True
    RegEx.Pattern = "[^\u0000-\u007F]"
    RegEx.IgnoreCase = True
    'Replace the UTF-8 characters
    ReplacedText = RegEx.Replace(FileText, "\u0020")
    If I understand regular expressions correctly the pattern of "[^\u0000-\u007F]" should replace any character that is not an ascii character, and then replace it with a space (which I understand is "\u0020").  What am I doing wrong?

    Simply use
    ReplacedText = RegEx.Replace(FileText, " ")
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • How to use regular expression replace for this special characters?

    hi,
    I need to replace the below string, but i couldnt able to do if we use the special charaters '+', '$' . can anyone suggest a way to do this?
    select REGEXP_REPLACE('jan + feb 2008','jan + feb 2008', 'feb',1,0,'i') from dual
    anwers should be :- feb

    you should use escape character \.
    the regular expression will look like as follows:
    select REGEXP_REPLACE('jan + feb 2008','jan \+ feb 2008', 'feb',1,0,'i') from dual
    hope this is what you needed.
    cheers,
    Davide

  • Regular expression - Replace a part of an expression

    Dear All,
    This is not a business requirement, just trying to practice regexp.
    Suppose we want to replace a part of a regular expression from a string. As an example, in the string 'THIS Number 124356 Is to Change.This Number 5 Also', I am trying to replace the last digit of each number with $ sign.
    Output will be
    'THIS Number 12435$ Is to Change.This Number $ Also'.
    Will this be possible using a single regexp_replce?
    Thanks in advance.

    MichaelS wrote:
    I am trying to achieve this using a SINGLE regexp_replace.Here we go:
    SQL> with t as (
    select 'ABC124556def568gh236klJ258' str from dual union all
    select 'THIS Number 124356 Is to Change.This Number 5 Also' str from dual
    select str, regexp_replace(str, '(\d{0,})\d{1}', '\1$') str2
    from t
    STR                                                     STR2                                                  
    ABC124556def568gh236klJ258                              ABC12455$def56$gh23$klJ25$                            
    THIS Number 124356 Is to Change.This Number 5 Also      THIS Number 12435$ Is to Change.This Number $ Also    
    2 rows selected.
    Nice..
    Learning for me ..
    Never thought of usage like {0,} ... kepping the end value OPEN.
    I was trying with \d+?\d, which was not working..

  • Regular expression does not work in IE

    Hi,
    I'm having a regular expression which should check the content of an inputText field: it should contain a number, a character and the size should be at least 6. It's working when I test it in FireFox but it always fails to succeed in IE:
              <af:inputText>
                <af:validateRegExp pattern="^(?=.*[a-zA-Z])(?=.*[0-9])[a-zA-Z0-9]{6,24}$"
                                   noMatchMessageDetail="Does not match."/>
              </af:inputText>How comes it does not work in IE (6.0)?
    JDeveloper 10.1.3.3
    Thanks in advance,
    Koen Verhulst

    hi Koen
    The web page you refer to ...
    http://www.fileformat.info/tool/regex.htm
    ... seems to be doing server side Java regular expressions (and as such will behave the same in both FF and IE).
    The af:validateRegExp component you want to use does client side evaluation of the regular expression, using scripting, hence the apparent difference between FF and IE.
    There is also this web page ...
    http://www.regular-expressions.info/javascriptexample.html
    ... that seems to behave similar to the markup and scripting resulting from the af:validateRegExp component.
    Besides the value "2abcdef" there seem to be others that are accepted by IE for the regular expression "^(?=.*[a-zA-Z])(?=.*[0-9])[a-zA-Z0-9]{6,24}$", values like these:
    "a2abcdef", "a2abcde", "abcdef2abcde", "2a3cdef", "2a34567"
    Although these values are not accepted by IE (but are accepted in FF):
    "2abcde", "23bcdef"
    success
    Jan

  • Regular Expression / replace Function Help

    The problem:
    cfset myString = "i am a big boy"
    cfset outputString = replace("i am a big
    boy","i","you","all")
    Wrong Output:
    you am a byoug boy
    Intended Output
    you am a big boy
    How do I achive that output.

    Your first example had only one sentence. That's why I gave
    that answer.
    Anyway for your real question, you need to use regular
    expressions
    #rereplace(myString,"i\s","you ","all")# - will give u
    you am a big boy you am a big boy you am a big boy you am a
    big boy.
    \s looks for a whitespace character after the letter i. So
    that way it will not change the letter i in big

  • Regular Expression/Replace - Oracle 7.3

    Hi!
    I am trying the regular expression SQL functions of 10g to Oracle 7.3 and it seems the older version does not cover this feature yet.
    "Aaaa,Bbbb" --> "Aaaa, Bbbb"
    REPLACE *",[0-9A-Za-z]"* WITH *", "*
    The string pattern is to look for comma-punctuations that is not followed immediately by whitespacess so I can replace this with a comma followed by a whitespace.
    Any workaround for this?

    Hi,
    Welcome to the forum!
    kitsune wrote:
    Hi!
    I am trying the regular expression SQL functions of 10g to Oracle 7.3 and it seems the older version does not cover this feature yet.You're right; regular expressions only work in Oracle 10.1 and higher.
    >
    >
    "Aaaa,Bbbb" --> "Aaaa, Bbbb"
    REPLACE *",[0-9A-Za-z]"* WITH *", "*
    The string pattern is to look for comma-punctuations that is not followed immediately by whitespacess so I can replace this with a comma followed by a whitespace.
    Any workaround for this?You're best bet in Oracle 7.3 would be a user-defined function. That's a very old version; don't expect much.
    Do you know anything else about the string? For example, is there some character (say ~) that never occurs in the string? Will there ever be two (or more) whitespace characters after punctuation? What characters do you consider to be whitespace? Which are punctuation? Depending on the answers, you might be able to do something with nested REPLACE and/or TRANSLATE functions.

  • Regular Expressions - replace inner group

    I'm trying to do the following:
    1. Given the following string:
    Truth, like tumors, require a cut to be removed.
    2. Grab the whole sentence and the following:
    like tumors
    3. Replace "like tumors" with "like posion" and add one line to the sentence like so:
    Truth, like posion, require a cut to be removed.
    To be free you must endure pain for a season to finally be free from it.
    I can grab the sentence with reg expressions, I can even grab the second search (#2) in a group, I'm just wondering if there is an elegant way to replace both at the same time. I could always replace one then search and replace the next, but that seems redundant since I can grab both the first time around. Any help?

    according to:
    http://javaalmanac.com/egs/java.util.regex/GroupInRep.html?l=find
    // Compile regular expression
    String patternStr = "\\((\\w+)\\)";
    String replaceStr = "<$1>";
    Pattern pattern = Pattern.compile(patternStr);
    // Replace all (\w+) with <$1>
    CharSequence inputStr = "a (b c) d (ef) g";
    Matcher matcher = pattern.matcher(inputStr);
    String output = matcher.replaceAll(replaceStr);
    // a (b c) d <ef> gthis should be exactly what you're looking for.

  • Regular expression does not execute runtime

    Hello adobe collegue's,
    I am currently stumbling on a strange issue regarding javascript embedded to compress a string:
    // main function to compress any string, removing all non-word characters and making the string all lowercase
    function compressString(input){
        var patt=new RegExp("\\W","g");
        patt.compile(patt);
        var output = input.toLowerCase().replace(patt,"")+"YESS";
        return output;
    Somehow this code does execute perfectly while previewing in adobe designer 9.0.0.2 but runtime all javascript does execute except for the part mentioned above.
    I know this part is executed because in the result i see the string "YESS" added to the response of this function.
    Somehow the pattern is not compiled, or executed runtime...
    I also tried more simple regular expressions but none of them actually worked.
    For the templates the option client is set where to execute the javascript, although while testing the options to solve the issue is also tried settings both and server. None provided the solution.
    Can someone provide any help...it's appreciated!
    Thanks,
    Marcel

    Hi,
    you can make your function more simple.
    function compressString(input){
              return input.toLowerCase().replace(/\W/g,"") + "YESS";

  • Regular Expression functions not supported in Interactive report filters ??

    I'm using APEX 4.0.2 and I'm trying to create a row filter in an interactive report which uses regexp_instr and regexp_replace functions and I'm getting the message:
    Invalid filter expression. regexp_instr
    The code runs fine in SQL Workshop
    select cytogenetics from z_patient
    where regexp_instr(regexp_replace(cytogenetics,'(\,+|\"+|\s)',''),'(^46XX$|^46XY$|^46XX\[..\]$|^46XY\[..\]$)')=1
    CYTOGENETICS
    "46,XX [20]"
    "46,XY[20]"
    "46,XX"
    "46,XY[20]"
    "46,XY[30]"
    "46,XY[26]"
    "46,XY [33]"
    "46,XX[32]
    etc...
    my filter is just the where clause above i.e.
    regexp_instr(regexp_replace(cytogenetics,'(\,+|\"+|\s)',''),'(^46XX$|^46XY$|^46XX\[..\]$|^46XY\[..\]$)')=1
    *Are regular expression functions just not supported in interactive report filters?*
    thanks in advance
    Paul P

    Hi Paul,
    regular expression functions are supported in interactive report filters, but it looks like that REGEXP_INSTR hasn't been added as valid command. Only REGEXP_SUBSTR and REGEXP_REPLACE are valid commands for computation expressions and REGEXP_SUBSTR, REGEXP_REPLACE and REGEXP_LIKE for row level filters.
    I have filed bug# 12926266 to fix this issue. Sorry for the inconvenience.
    Regards
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • Exception thrown as regular expression is not recognized

    Hi all,
    My code throws me an exception, telling me that there are no files matching my file pattern, but I have three files which should match the file pattern in my input folder: /home/rkuite/test/asnout/store/ . There are three files there: ASN00507.txt, ASN00512.txt and ASN00531.txt
    My code looks like this:
    [outputtostore jcaps code|http://www.risa-webdesign.nl/jcaps_code/jcd_outputtostore.TXT]
    And the error I get is as follows:
    [error message when I execute the code|http://www.risa-webdesign.nl/jcaps_code/error_message.TXT]
    I have tried various options and things to resolve this but to no avail, so I'd like to ask your help: what is wrong with the code?
    Thanks & Kind Regards,
    Richard

    The error message:
    java.io.FileNotFoundException: Directory Name: /home/rkuite/test/asnout/store/ File name: ^ASN*--- End of nested exception.
    Is telling you that no files exist that begin with AS followed by zero or more N's. I believe the following regular expression would work better:
    ^ASN[0-9]*\.txt$
    This would match any file name that began with ASN and was followed by zero or more digits zero thru nine and then ended with the dot txt.
    Regards,
    AK~

  • Match Regular Expression does not match what Match Pattern does

    I have read through a lot of posts about how Match Pattern does not match what Match Regular Expression will due to not processing some characters.
    However, I found a problem with the other way. A simple Reg-Ex that works in Match Pattern but not Match Regular Expression.
    What I have here is just an example. I want to use Match Regular Expression so I can specify some sub-matches.
    The reg-ex is for: one or more non-numeric characters, a space, one or more numeric characters. At the start of the string.
    How can I get this working in Match Regular Expression? I am working in LabVIEW 2010f2 32 bit. Here is the code snippet and the results:
    Rob
    Solved!
    Go to Solution.

    Robert Cole wrote:
    I think I prefer the ~ for negation since ^ is also used for beginning of the string. But we work with what we have.
    Let me offer you a tip and perhaps defend the honor of the regex a little bit.  One of my favorite features of regexes is the ability to specify character classes (and their negation).  One of the reasons I have to think about the ~ versus ^ is that I rarely use ^ in a regex alternative. 
    Some examples:
    [0-9] = \d (digit)
    [^0-9] = \D (not a digit)
    The equivalent regex for your case is: \D+ \d+

  • Regular Expression "Replace"

    (<PartName>([a-z]))(.*)(</PartName>)
    I need to change all copy within the <PartName></PartName> tags with Sentence Case. Above selects all the copy that doesn't have a capital.
    To write the above out in find and repalce, I would just use $1$2$3$4 but I need the $2 to be a Capital.
    What's crazy is that this would seem to be a fairly common thing to do yet finding an answer is nearly impossible. I even have OReilly's Regular Expression Cookbook book and there's nothing in it about replacing text with changed text.
    I've been on this for a day now and it's getting to the point where I could have gone through and done it manually in less time.
    Sorry for the rant...

    I gave up and just exported out from my xml into Excel and did a formula there...

  • My Regular Expression is not replaceing lines with br / in them

    here is my problem
    This is my original Code:
    <p class="x3-subheading-1">DEGREE: Bachelor of Accountancy<br />MAJOR: Accounting</p>
    I want to find and replace all instances of this subheading class with this:
    <h3>******************</h3>
    This is what has worked for me for ones without <br />:
    Find:           <p class="x3-subheading-1">([^<]*)</p>
    Replace:      <h3>$1</h3>

    Managed to figure out this as a work arround.
    Find:          <p class="x3-subheading-1">([^<]*)<br />([^<]*)</p>
    Replace:     <h3>$1<br />$2</h3>
    Depending on the number of <br /> you can just add more
    Find:          <p class="x3-subheading-1">([^<]*)<br />([^<]*)<br />([^<]*)</p>
    Replace:     <h3>$1<br />$2<br />$3</h3>

  • Help with regular expression to not run shtml-hacktype on particular reqs

    Hi,
    Okay, back to 7.0 u2 not ignoring things it should. Our regular site has a lot of SHTML includes. Then we have the glassfish loadbalancer plugin configured for a back-end web application. The problem is, the application URLs end in .html and the web server is looking locally for those requests. If I disable:
    ObjectType fn="shtml-hacktype"In the instance obj.conf, then the requests process normally in the proxy.
    I can't do that, though, because of the includes - then our main site doesn't function properly.
    Is there a way I can surround that line with something like "if request is not /gog/*" then execute? Similar to what I had to do for the j2ee problem looking locally instead of on the back end Weblogic servers.
    <If $uri =~ '^/wp-(.*)'>
    NameTrans fn="ntrans-j2ee" name="j2ee"
    </If>Only I want the opposite - if $uri is not equal to '^/gog/(.*)' then execute the shtml hacktype. I just don't know exactly what the expression would be.
    Thanks!

    Nevermind - I got it. RTFM :-)
    <If $uri !~ '^/gog/(.*)'>
    ObjectType fn="shtml-hacktype"
    </If>

Maybe you are looking for

  • E-mail alerts

    My new 3G is great. However... My previous phone had a feature that the iPhone lacks. I used that feature to provide an alert that I wanted, and I'm wondering how to use features, app's, etc of the iPhone to recreate that alerting service. 1. *My own

  • Error in BAPI_INCOMINGINVOICE_CREATE in miro for delivery cost

    E              M8         321         Document contains same order item more than once                     000000  6500020704         00110 I am getting this error message while booking multiple delivery cost Invoices against the same Purchase Order

  • Dynamically updating data in a webpage ..... help/suggestions please?

    Hi All, I have a simple delimited text file of current weather observations (less than 20 items) updated every 15 minutes, which I display via an embedded  Flash animation.  I would like to do away with the Flash approach, and display the data in tab

  • Cant get into my mac book pro, asking to change my password to let me in and it wont

    Cant get into my mac book pro, asking to change my password to let me in and it wont.

  • Trim With Outer Join in where

    Getting an error called Invalid relational Operator SELECT DISTINCT t1.recv_order_no, t2.reference_no FROM receiving_order t1, receiver_num t2 WHERE TRIM(t2.reference_no) (+) = TRIM (t1.recv_order_no) ORDER BY t2.reference_no ASC What I am doing wron