Regexp_like question

Hi,
I would like to know how to catch new line character with regexp_like expression ? Is there a special character like \n in Unix ?
Cheers,
Thomas

In 10g2, you have Perl-Influenced Extensions in Oracle Regular Expressions.
C.

Similar Messages

  • Quick REGEXP_LIKE Question

    Hi everyone,
    Had a very quick question: so I need to retrieve all records that have values in this format "type:123;target_id:456". Note that the numeric value can be 1-6 digits long for either type or target_id.
    Can someone please help me with the regexp_like-ing this?
    Thank you,
    Edited by: vi2167 on May 27, 2009 2:06 PM
    Edited by: vi2167 on May 27, 2009 2:07 PM

    WHERE REGEXP_LIKE(val,'type:\d{1,6};target_id:\d{1,6}')SY.

  • What   regexp_like do

    Hi ,
    I am using oracle 10g
    there is one query in my code like
    select * from tab
    where group_id = 1000
    and
    regexp_like(group_desc,'(^US*)|(^WW*)')
    My question is what regexp_like(group_desc,'(^US*)|(^WW*)') will do

    Ganesh Srivatsav wrote:
    The regexp_like condition you have in your query is same as
    WHERE group_desc like 'US%'
    OR group_desc like 'WW%'G.not true, the second character is optional in the regexp.
    SQL> with t as (select 'US' group_desc from dual
      2             union all
      3             select 'UB' from dual
      4             union all
      5             select 'W' from dual
      6             union all
      7             select 'WWaaahh' from dual
      8             union all
      9             select 'USSSS' from dual)
    10  select *
    11    from t
    12   where regexp_like(group_desc,'(^US*)|(^WW*)') ;
    GROUP_DESC
    US
    UB
    W
    WWaaahh
    USSSS
    5 rows selected.
    Elapsed: 00:00:00.00
    SQL> with t as (select 'US' group_desc from dual
      2             union all
      3             select 'UB' from dual
      4             union all
      5             select 'W' from dual
      6             union all
      7             select 'WWaaahh' from dual
      8             union all
      9             select 'USSSS' from dual)
    10  select *
    11    from t
    12   WHERE group_desc like 'US%'
    13        OR group_desc like 'WW%';
    GROUP_DESC
    US
    WWaaahh
    USSSS
    3 rows selected.

  • Numeric and non numeric question

    i have a question regarding value in column
    if certain value in column is text i need to display 'abc'
    if it is numeric then 'efg'
    how to check that..i mean what function i need to use

    Toon Koppelaars wrote:
    You could create a function to test this:
    If OP is on 10g, he can use REGEXP_LIKE:
    SELECT  CASE
              WHEN :p_input IS NULL THEN '"" is NULL'
              WHEN REGEXP_LIKE(:p_input,'^( *)(\+|-)?((\d*[.]?\d+)|(\d+[.]?\d*)){1}(e(\+|-)?\d+)?(f|d)?$','i') THEN '"' || :p_input || '" is a number'
              ELSE '"' || :p_input || '" is not a number'
            END is_number
      FROM  dual
    /For example:
    SQL> SELECT  CASE
      2            WHEN :p_input IS NULL THEN '"" is NULL'
      3            WHEN REGEXP_LIKE(:p_input,'^( *)(\+|-)?((\d*[.]?\d+)|(\d+[.]?\d*)){1}(e(\+|-)?\d+)?(f|d)?$','i') THEN '"' || :p_input || '" is a number'
      4            ELSE '"' || :p_input || '" is not a number'
      5          END is_number
      6    FROM  dual
      7  /
    IS_NUMBER
    "-7.8E+12" is a number
    SQL> EXEC :p_input := '-7.8E+12.5';
    PL/SQL procedure successfully completed.
    SQL> /
    IS_NUMBER
    "-7.8E+12.5" is not a number
    SQL> REGEXP_LIKE pattern is based on number diagram posted in Oracle docs.
    SY.

  • Need help in REGEXP_LIKE

    Hi All,
    i need a help in REGEXP_LIKE for following condition as follows.
    a column has value as
    ALLOW
    TO ALL PERSON
    ALLOW ME
    in this i have check the following condition.
    excepted result:
    if i give
    REGEXP_LIKE(column_name,'ALL')
    Result:
    1 row selected
    if i give
    REGEXP_LIKE(column_name,'ALLOW THIS PERSON')
    Result:
    0 rows selected.
    Thanks & Regards
    Sami
    Edited by: Sami on Nov 2, 2010 6:08 PM
    Edited by: Sami on Nov 2, 2010 6:09 PM

    Please use the {noformat}{noformat}tag and post formatted data.
    For example, when you type (or copy/paste):
    {noformat}select *
    from dual;
    {noformat}
    it will appear as:select *
    from dual;
    on this forum.
    See for FAQ for more tags: http://forums.oracle.com/forums/help.jspa
    Regarding your question: what is your exect desired output? It's not 100% clear to me what you want.
    If I use your first 'example' I get three rows:SQL> -- generating sample data:
    SQL> with t as (
    2 select 'ALLOW' col from dual union
    3 select 'TO ALL PERSON' from dual union
    4 select 'ALLOW ME' from dual
    5 )
    6 --
    7 -- actueal query:
    8 --
    9 select col
    10 from t
    11 where regexp_like(col, 'ALL');
    COL
    ALLOW
    ALLOW ME
    TO ALL PERSON
    3 rows selected.

  • MS/UNIX/DB question - How to find MS characters in Unix scripts.

    Hi. I apologise if this is a bit off-topic.
    We have been developing sql scripts on PC's but need to run them from UNIX. We are find Microsoft characters like double spaces followed by a dash convert into little squares and upside down question marks. etc.
    I can find them in the database using:
    SELECT description_text, dump(description_text)
       FROM descriptions
      WHERE regexp_like( description_text, '[^[:print:][:space:]]');And get things like "Adjustment � Service".
    In unix that might appear as "\266" in the middle of a text string. We find them in the db, fix them, and re-deploy.. but this is getting tiresome.
    I want to be able to repeatedly scan all sql scripts in Unix, including files in subdirectories. (there are literally hundreds..)
    We're running SunOS 5.10. I have tried "grep -r {266}" but the -r option isn't valid with my version of grep... :(
    Any suggestions about the easiest/most pragmatic way of doing this?
    Thanks in advance. :)
    Pete
    Edited by: peetmoore on 11-Aug-2009 19:51

    I couldn't get the shell script to work, so just kept playing with command line.
    The closest I have is:   find . -name "*.sql"  | xargs  grep 'xyz' Or using od: find . -name "*" | xargs | od -c | grep 'xyz' But i'm struggling a bit to identify and filter the specifc characters i'm looking for. They appear differently depending on how they're being viewed. (or not at all.) in some cases 2 spaces following by a dash " -" appeared as an update down question mark in Sql and "\266" in the unix script when viewed in vi. I don't have any current examples so it's hard to see what it looks like in od.

  • Using REGEXP_LIKE to query with exclusion

    Dear all,
    how to query a column that doesn't contain value with a particular letter in the middle of it using REGEXP_LIKE? Suppose I have the following:
    SQL> select * from test;
    TEMP
    john
    joni
    jane
    johny
    jonny
    SQL> select temp from test where regexp_like(temp,'[^h]');
    TEMP
    john
    joni
    jane
    johny
    jonny
    SQL> select temp from test where regexp_like(temp,'[a-z]+[^h][a-z]+');
    TEMP
    john
    joni
    jane
    johny
    jonnyThe above code tries to query temp that doesn't contain letter 'h' in the middle (so it querries joni, jane, and jonny) but it cannot be done with
    regexp_like(temp,'[^h]');
    regexp_like(temp,'[a-z]+[^h][a-z]+');since these 2 patterns satisfy all the available rows. What is the solution?
    Best regards,
    Val

    Frank Kulash wrote:
    Hi,
    Valerie Debonair wrote:
    Hi Frank,
    could you give another example, this time involves not equal character ^ instead of using NOT?Why? What's wrong with NOT?
    There are other (more complicated and/or less efficient) ways to get the same results, but whatever objection you have to NOT might apply to those ways, too. Rather than have people suggest solutions one at a time, and wait for you to say "I can't use that", I suggest you explain why you can't use it, so that the next solution won;t have the same problem.
    ^ doesn't mean "not"; it means "something other than" or "anything except". This problem doesn't involve whther or not the string contains something other than 'h'; it only matters whether or not the string conatins 'h'.Hi Frank,
    the purpose of this question is for me to understand the usage of ^ character with REGEXP_LIKE. While your solution solves the particular case that I asked, it didn't fully serve the purpose of the question even though it works well in the real world. In order words, I was focusing on the semantic of regular expression.
    Thanks for the help though, your explanation on ^ character sheds me some light.......

  • Validation General Questions

    I have a couple of general questions on validation.
    1) I have a text field defined as a "Required" field (it is using the form_required template). Must I also create a NOT NULL validation on this field as well? It seems that I should not have to do this. However, if I do not create this NOT NULL validation, then clicking on a Submit button while this field is empty is not generating any error message. But when I include a NOT NULL validation, then I do get an error message.
    2) This question is related to the first. I tried creating a regular expression validation on my field in which I use the pattern
    [[:alnum:]]{1,}[|$#&_?]+
    The field should allow the user to type-in a string consisting of 1 or more alphanumeric characters (it could be a foreign language characters as well)
    and 1 or more special characters like $ or #.
    I thought this would also generate an error message if the user clicks the Submit button while leaving the field empty. But, again, I get no error message. Why?
    Thank you in advance for any insight on this.

    Thanks very much, Justin.
    When I saw the regexp_like() function in your reply, I am wondering if, perhaps, you might also have some insight into how I can ckeck if a field contains non-English type characters (i.e., mult-byte characters). I already posted a question about this an hour ago but have not gotton any replies as yet. In my post I asked about using the regular expression pattern [[:alnum:]] since the docs state that this will check for mult-byte characters. And so, I thought if perhaps there is some function I might use to return a boolean TRUE if a field contains non-English characters versus a FALSE if it contains only English characters.
    Any insight in this would be most appreciated.
    Thanks again for your help.

  • REGEXP_LIKE help - escaping the hyphen

    I need to match string that does not contain "dc-ba" - all are literal. It has to return true for all strings that is not "ab-cd".
    The hypen is creating the problem. If hypen were not there:
    select ('Matched') "Status" from dual where REGEXP_LIKE('def', '[^(^dcba$)]');
    Matchedselect ('Matched') "Status" from dual where REGEXP_LIKE('dcba', '[^(^dcba$)]');
    no rows returnedEverything is as required to this point, but when I try to apply the same with hypen:
    select ('Matched') "Status" from dual where REGEXP_LIKE('dc-ba', '[^(^dc-ba$)]');
    Error: ORA-12728: Invalid range in regular expression
    If I try to escape the hyphen:
    select ('Matched') "Status" from dual where REGEXP_LIKE('dc-ba', '[^(^dc\-ba$)]');
    MatchedWhich sould not be the case. It shoudl match all string other than "dc-ba".
    Am I doing something wrong?

    Tubby,
    it is not just a question of replacing all the hyphens with something that's "special" that won't mess with the regular expression. First of all, that "special" can never occur in source data. For example, replacing hyphens with tilda could result in rejecting dc~ba:
    SQL> select ('Matched') "Status" from dual where REGEXP_LIKE(REPLACE('dc~ba', '-','~'), REPLACE('[^(
    ^dc-ba$)]', '-','~'));
    no rows selected
    SQL> Secondly, there is over a dozen special meaning characters in regular expressions, so each of them must be replaced with a chatacter that can not appear in source data.
    SY.

  • Questions on Print Quote report

    Hi,
    I'm fairly new to Oracle Quoting and trying to get familiar with it. I have a few questions and would appreciate if anyone answers them
    1) We have a requirement to customize the Print Quote report. I searched these forums and found that this report can be defined either as a XML Publisher report or an Oracle Reports report depending on a profile option. Can you please let me know what the name of the profile option is?
    2) When I select the 'Print Quote' option from the Actions drop down in the quoting page and click Submit I get the report printed and see the following URL in my browser.
    http://<host>:<port>/dev60cgi/rwcgi60?PROJ03_APPS+report=/proj3/app/appltop/aso/11.5.0/reports/US/ASOPQTEL.rdf+DESTYPE=CACHE+P_TCK_ID=23731428+P_EXECUTABLE=N+P_SHOW_CHARGES=N+P_SHOW_CATG_TOT=N+P_SHOW_PRICE_ADJ=Y+P_SESSION_ID=c-RAuP8LOvdnv30grRzKqUQs:S+P_SHOW_HDR_ATTACH=N+P_SHOW_LINE_ATTACH=N+P_SHOW_HDR_SALESUPP=N+P_SHOW_LN_SALESUPP=N+TOLERANCE=0+DESFORMAT=RTF+DESNAME=Quote.rtf
    Does it mean that the profile in our case is set to call the rdf since it has reference to ASOPQTEL.rdf in the above url?
    3) When you click on submit button do we have something like this in the jsp code: On click call ASOPQTEL.rdf. Is the report called using a concurrent program? I want to know how the report is getting invoked?
    4) If we want to customize the jsp pages can you please let me know the steps involved in making the customizations and testing them.
    Thanks and Appreciate your patience
    -PC

    1) We have a requirement to customize the Print Quote report. I searched these forums and found that this report can be defined either as a XML Publisher report or an Oracle Reports report depending on a profile option. Can you please let me know what the name of the profile option is?
    I think I posted it in one of the threads2) When I select the 'Print Quote' option from the Actions drop down in the quoting page and click Submit I get the report printed and see the following URL in my browser.
    http://<host>:<port>/dev60cgi/rwcgi60?PROJ03_APPS+report=/proj3/app/appltop/aso/11.5.0/reports/US/ASOPQTEL.rdf+DESTYPE=CACHE+P_TCK_ID=23731428+P_EXECUTABLE=N+P_SHOW_CHARGES=N+P_SHOW_CATG_TOT=N+P_SHOW_PRICE_ADJ=Y+P_SESSION_ID=c-RAuP8LOvdnv30grRzKqUQs:S+P_SHOW_HDR_ATTACH=N+P_SHOW_LINE_ATTACH=N+P_SHOW_HDR_SALESUPP=N+P_SHOW_LN_SALESUPP=N+TOLERANCE=0+DESFORMAT=RTF+DESNAME=Quote.rtf
    Does it mean that the profile in our case is set to call the rdf since it has reference to ASOPQTEL.rdf in the above url?
    Yes, your understanding is correct.3) When you click on submit button do we have something like this in the jsp code: On click call ASOPQTEL.rdf. Is the report called using a concurrent program? I want to know how the report is getting invoked?
    No, there is no conc program getting called, you can directly call a report in a browser window, Oracle reports server will execute the report and send the HTTP response to the browser.4) If we want to customize the jsp pages can you please let me know the steps involved in making the customizations and testing them.
    This is detailed in many threads.Thanks
    Tapash

  • Satellite P300D-10v - Question about warranty

    HI EVERYBODY
    I have these overheating problems with my laptop Satellite P300D-10v.
    I did everything I could do to fix it without any success..
    I get the latest update of the bios from Toshiba. I cleaned my lap with compressed air first and then disassembled it all and cleaned it better.(it was really clean insight though...)
    BUT unfortunately the problem still exists...
    So i made a research on the internet and I found out that most of Toshiba owners have the same exactly problem with their laptop.
    Well i guess this is a Toshiba bug for many years now.
    Its a really nice lap, cool sound (the best in laptop ever) BUT......
    So I wanted to make a question. As i am still under warranty, can i return this laptop and get my money back or change it with a different one????
    If any body knows PLS let me know.
    chears
    Thanks in advance

    Hi
    I have already found you other threads.
    Regarding the warranty question;
    If there is something wrong with the hardware then the ASP in your country should be able to help you.
    The warranty should cover every reparation or replacement.
    But I read that you have disasembled the laptop at your own hand... hmmm if you have disasembled the notebook then your warrany is not valid anymore :(
    I think this should be clear for you that you can lose the warrany if you disasemble the laptop!
    By the way: you have to speak with the notebook dealer where you have purchased this notebook if you want to return the notebook
    The Toshiba ASP can repair and fix the notebook but you will not get money from ASP.
    Greets

  • Question regarding NULL and forms

    Hi all, i have a survey that im working on that will be sent via email.
    I'm having an issue though. if i have a multiple choice question, and the user only selects one of the choices, all the unselected choices return as NULL. is there a way i can filter out anytihng that says "NULL" so it only shows the selected options?
    thanks.
    here is the page that retrieves all the data. thanks
    <body>
    <p>1) Is this your first visit to xxxxxxx? <b><%=request.getParameter("stepone") %></b>
    </p>
    <p> </p>
    <p>2) How did You Learn About xxxxxxx?</p>
    <p><b><%=request.getParameter("steptwoOne") %></b>
      <br>
        <b><%=request.getParameter("steptwoTwo") %></b>
      <br>
        <b><%=request.getParameter("steptwoThree") %></b>
      <br>
        <b><%=request.getParameter("steptwoFour") %></b>
      <br>
        <b><%=request.getParameter("steptwoOther") %></b>
    </p>
    <p> </p>
    <p>3) What was your main reason for visiting xxxxx?</p>
    <p><b><%=request.getParameter("stepthreeOne") %></b>
        <br>
          <b><%=request.getParameter("stepthreeTwo") %></b>
        <br>
          <b><%=request.getParameter("stepthreeThree") %></b>
        <br>
          <b><%=request.getParameter("stepthreeFour") %></b>
        <br>
          <b><%=request.getParameter("stepthreeOther") %></b>
    </p>
    <p>4) did you find the information you were looking for on this site?</p>
    <p><b><%=request.getParameter("stepfour") %>
    <br>
    <b><%=request.getParameter("stepfourOther") %></b>
    </b></p>
    <p>5) Do you plan on using this website in the future?</p>
    <p><b><%=request.getParameter("stepfive") %></b></p>
    <p>6) What is your gender</p>
    <p><b><%=request.getParameter("stepsix") %></b></p>
    <p>7) What is your age group</p>
    <p><b><%=request.getParameter("stepseven") %></b></p>
    8) Would you like to take a moment and tell us how we can improve your experience on xxxxxxxxxx?
    <p><b><%=request.getParameter("stepeightFeedback") %></b></p>

    i was messing around and came up with this. it doesnt remove the null, but if it is null it adds ABC beside it. so i think i might be getting close. i just need to figure out how to replace the null.
    code]
    <b><%=request.getParameter("steptwoFour") %></b>
         <% if (request.getParameter("steptwoFour") == null ) {
         %>
         <% out.print("abc"); %>
         <% }
         %>

  • Anyone know how to remove Overdrive books from my iphone that have been transferred from my computer? They do not show up on itunes. I see a lot of answers to this question but they all are based on being able to see the books in iTunes.

    How do I remove Overdrive books from the library that were downloaded onto my computer then transferred to my iphone? The problem is that they do not show up in iTunes.
    I see this question asked a lot when I google, but they always give answers that assumes you can find the books in iTunes either under the books tab, or the audio books tab or in the music. They do not show up anywhere for me. They do not remove from the app like the ones I downloaded directly onto my iphone.the related archived article does not answer it either.  I even asked a guy working at an apple store and he could not help either.   Anybody...?
    Thanks!

    there is an app called daisydisk on mac app store which will help you see exactly where the memory is focused and consumed try using that app and see which folders are using more memory

  • Basic question

    Hello, i have a basic question. if i have defined 2 fields in a cube or a dso:
    Name Quantity
    and from the external flat file i get some characters for my quantity field. would my load fail?  for standard dso and for write optimized?
    NOTE: quantity field is a keyfigure defined as numeric.
    and the load coming in has "VIKPATEL" for Quantity field and not numbers.
    thanks

    Hi Vik,
    Yes, the load will fail.
    May be you coud first load this data into BW (into PSA) and set both fields as characters fields. Then you can create DSO, do transformation from this PSA to the DSO, and put your logic as to what do you want to do with those Quantity that is not number (e.g. convert to 0, or 'Not assgined', etc).
    You can use transfer rule, or a clean up ABAP code in the start routine.
    Hope this helps.

  • Mid 2010 15" i5 Battery Calibration Questions

    Hi, I have a mid 2010 15" MacBook Pro 2.4GHz i5.
    Question 1: I didn't calibrate my battery when I first got my MacBook Pro (it didn't say in the manual that I had to). I've had it for about a month and am doing a calibration today, is that okay? I hope I haven't damaged my battery? The calibration is only to help the battery meter provide an accurate reading of how much life it has remaining, right?
    Question 2: After reading Apple's calibration guide, I decided to set the MacBook Pro to never go to sleep (in Energy Saver System Preference) and leave it on overnight so it would run out of power and go to sleep, then I'd leave it in that state for at least 5 hours before charging it. When I woke up, the light on the front wasn't illuminated. It usually pulsates when in Sleep. Expectedly, it wouldn't wake when pressing buttons on the keyboard. So, what's happened? Is this Safe Sleep? I didn't see any "Your Mac is on reserve battery and will shut down" dialogues or anything similar, as I was asleep! I've left it in this state while I'm at work and will charge it this afternoon. Was my described method okay for calibration or should I have done something different?
    Question 3: Does it matter how quickly you drain your battery when doing a calibration? i.e is it okay to drain it quickly (by running HD video, Photo Booth with effects etc) or slowly (by leaving it idle or running light apps)?
    Thanks.
    Message was edited by: Fresh J

    Fresh J:
    A1. You're fine calibrating the battery now. You might have gotten more accurate readings during the first month if you'd done it sooner, but no harm has been done.
    A2. Your machine has NOT shut down; it has done exactly what it was supposed to do. When the power became critically low, it first wrote the contents of RAM to the hard drive, then went to sleep. When the battery was completely drained some time later, the MBP went into hibernation and the slepp light stopped pulsing and turned off. In that state the machine was using no power at all, but the contents of your RAM were still saved. Once the AC adapter was connected, a press of the power button would cause those contents to be reloaded, and the machine would pick up again exactly where you left off. It is not necessary to wait for the battery to be fully charged before using the machine on AC power, but do leave the AC adapter connected for at least two hours after the battery is fully charged. Nothing that you say you've done was wrong, and nothing that you say has happened was wrong.
    A3. No, it does not matter.

Maybe you are looking for

  • IMessage two users, one account

    Hi, I have had an iTunes account for a while now. Lots of music and so forth. My wife recently purchased an iPhone so now we have two users on the same account. Everything's fine except for iMessages. We are both receiving each others IMessages. Can

  • Very Important Raid Question

    PLEASE CAN SOME ONE TELL HOW TO GET MY RAID DRIVES BACK ON THE TRACK. MY MSI MAX2 845 RAID BORD IS BROKE, AND I WANT TO READ MY DRIVES AS SOON AS POSSIBLE. WITH WHAT? I CANNOT FIND/BUY ANOTHER BORD. HELP HELP HELP

  • 41439 Login Error  / Invalidation User password

    Portal Login Error 41439: I have Infrastructure and App Server (BI installation) on the same Win2K server. While trying to Login to Oracle10gAS Portal, I get following error. WWV-41439 - You cannot login because there is no configuration information

  • 42SL417U Youtube app stopped working

    Greetings, A few days ago, the Youtube app stopped working. The logo comes up, but the progress bar that normally shows loading progress never starts. I have tried unplugging the TV for several hours, but that's about it. Are there any other steps I

  • Having trouble with a game

    I'm having trouble trying to get the enemy character in a game to attack once and then over again. Right now it's not going through the whole attack animation. If anyone has any ideas that would be great. the site is here: http://billzgames.comule.co