Matches from regular expression into collection

Hello,
I need to do the following:
I have a long string with some similar repeated data. I would like, using a regular expression, to extracts all matches in a collection. Is there a way of performing this task?
I have look through the owa_pattern package, but as far as I found out, I can extract only a simple match. Here is an exact quote:
"If multiple overlapping strings can match the regular expression, this function takes the longest match. " - http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/w_patt.htm
So what can I do if I want to get all the matches?
Thank you in anticipation. Any help would be appreciated.
Best regards,
beroetz

I think your need a tokenizer-function.
If the string +:in_str+ is delimited by +:in_delimiter+ you could try this:
SELECT REGEXP_REPLACE(REGEXP_SUBSTR( :in_str || :in_delimiter, '(.*?)' || :in_delimiter, 1, LEVEL ), :in_delimiter, '') TOKEN
BULK COLLECT INTO :my_nested_table
FROM DUAL
CONNECT BY REGEXP_INSTR( :in_str || :in_delimiter, '(.*?)' || :in_delimiter, 1, LEVEL ) > 0
ORDER BY LEVEL ASC;
I wrote a string-to-textarray-tokenizer (and it's pendant) some times ago, being able to cut from certain positions within the string using regular expressions and return the elements into an nested table of varchar2. It looks like:
TYPE pos_arraytype IS TABLE OF POSITIVE ;
TYPE text_arraytype IS TABLE OF VARCHAR2(2000);
FUNCTION stringToTextarray(in_str IN VARCHAR2, in_pos_arr IN pos_arraytype, in_regexp_arr IN text_arraytype DEFAULT NULL, in_trim_strings IN BOOLEAN DEFAULT TRUE)
RETURN text_arraytype ;
in_str is the string to be tokenized
in_pos_arr is a table of positive values of positions in the string to be cut
in_regexp_arr is a table of regular expressions to use at each position declared by in_pos_arr
in_trim_strings is a flag, if the cutted element should be trimmed
using above for example:
in_str = 'Markus van Muster 347651234XY Musterdaam ABCDE'
in_pos_arr = (1, 13, 35, 35, 42)
in_regexp_arr = ('(.?){12}', '([^[:digit:]]?){22}', '[[:digit:]]{4}', '[[:alpha:]]{2}', '(.?){14}')
in_trim_strings = TRUE
RETURN collection ('Markus','van Muster','1234','XY','Musterdaam')
If you need the code, then tell me! I'm looking for....
Cheers,
Martin
Edited by: Nuerni on 17.10.2008 08:49

Similar Messages

  • Regular Expressions and Collections

    Is it possible to use refular expressions when validating collection items?
    I have a loop that checks collection values for null, not null etc. I would also like to validate the format of some text fields in the same collection loop.
    i.e.
    for i in 1..htmldb_application.g_f02.count
    loop
    if
    replace(htmldb_application.g_f07(i), 'NULL',NULL) is null
    and TO_NUMBER(NVL(htmldb_application.g_f02(i), 0)) > 0
    THEN
    return 'A Demand Quantity Value Must Be Specified.';
    elsif
    -- check htmldb_application.g_f07(i) is correctly formatted using Reg Expressions
    then
    return 'Reg Expression error text goes here';
    end if;
    end loop;
    Regards
    Duncan

    Well, the obvious answer is "only write the data to the database if the input doesn't match the regular expression."
    Presumably you're really asking how to do that - but it depends upon how your application is structured in the first place, and you haven't told us anything at all about that.

  • Pattern matching using Regular expression

    Hi,
    I am working on pattern matching using regular expression. I the table, I have 2 columns A and B
    A has value 'A499BPAU4A32A386KBCZ4C13C41D20E'
    B has value like '*CZ4*M11*7NQ+RDR+RSM-R9A-R9B'
    the requirement is that I have to match the columns of B in A. If there is a value with * sign, this must be present in A like 'CZ4' should exit in string A.
    The issue I am facing is that there are 2 values with * sign. The code works fine for first match (CZ4) but it does not look further as M11 does not exist in A.
    I used the condition
    AND instr(A,substr(REGEXP_SUBSTR(B, '*[^*]{3}'),2) ,1)=0
    First of all, is this possible to match multiple patterns in one condition?
    If yes, please suggest.
    Thanks

    user2544469 wrote:
    Thanks a lot Frank. This query worked wonderful for the test data I have provided however I have some concerns:
    - query doesnot include the column BOOK which is a mandatory check.Sorry, that was my mistake. It was a very easy mistake to make, since you posted sample data where it didn't matter. Instead of doing a cross-join between vn and got_must_have_cnt, do an inner join, using book. That means book will have to be in got_must_have_cnt, and all the sub-queries from which it descends. Look for comments that say "March 22".
    If you want to treat '+' in test_cat.codes as '*', then the simplest thing is probably just to use REPLACE, so that when the table has '+', you use '*' instead.
    WITH     got_token_cnt     AS
         SELECT     cat
         ,     book                                        -- Added March 22
         ,     REPLACE (codes, '+', '*') AS codes                    -- If desired.  Changed March 22
         ,     LENGTH (codes) - LENGTH ( TRANSLATE ( codes
                                                       , 'x*+-'
                                      , 'x'
                             ) AS token_cnt
         FROM    test_cat
    ,     cntr     AS
         SELECT     LEVEL     AS n
         FROM     (  SELECT  MAX (token_cnt)     AS max_token_cnt
                 FROM        got_token_cnt
         CONNECT BY     LEVEL     <= max_token_cnt
    ,     got_tokens     AS
         SELECT     t.cat
         ,     t.book                                        -- Added March 22
         ,     REGEXP_SUBSTR ( t.codes
                         , '[*+-]'
                         , 1
                         , c.n
                         )          AS token_type
         ,     SUBSTR ( REGEXP_SUBSTR ( t.codes
                                       , '[*+-][^*+-]*'
                               , 1
                               , c.n
                   , 2
                   )          AS token
         FROM     got_token_cnt     t
         JOIN     cntr          c  ON     c.n     <= t.token_cnt
    ,     got_must_have_cnt     AS
         SELECT       cat, book                                   -- Changed March 22
         ,       COUNT (CASE WHEN token_type = '*' THEN 1 END) AS must_have_cnt
         FROM       got_tokens
         GROUP BY  cat, book                                   -- Changed March 22
    SELECT       mh.cat
    ,       vn.vn_no
    FROM       got_must_have_cnt     mh
    JOIN                    vn  ON  mh.book     = vn.book               -- Changed March 22
    LEFT OUTER JOIN      got_tokens     gt  ON     mh.cat                  = gt.cat
                                     AND INSTR (vn.codes, gt.token) > 1
    GROUP BY  mh.cat
    ,            mh.must_have_cnt
    ,            vn.vn_no
    HAVING       COUNT (CASE WHEN gt.token_type = '*' THEN 1 END)     = mh.must_have_cnt
    AND       COUNT (CASE WHEN gt.token_type = '-' THEN 1 END)     = 0
    ORDER BY  mh.cat
    - query is very slow with 60000 records in vn table. Cost is somewhere around 36000.See these threads:
    When your query takes too long ...
    HOW TO: Post a SQL statement tuning request - template posting
    Relational databases were designed to have (at most) one piece of information in each column. If you decide to have multiple items in the same column (as you have a variable number of tokens in the codes column), don't be surprised if that makes things slower and more complicated. Most of the query I posted, and perhaps most of the time needed, is jsut to normalize the data. If you stored the data in a narmalized form, perhaps something like got_tokens, then you wouldn't need the first 3 sub-queries that I posted.
    Edited by: Frank Kulash on Mar 22, 2011 12:04 PM

  • XML node name matching with regular expressions

    Hello,
    If i have an xml file that has the following:
         <parameter>
              <name>M2-WIDTH</name>
              <value column="09" date="2004-10-31T19:56:30" row="03" waferID="PUK444150-20">10.4518</value>
         </parameter>
         <parameter>
              <name>M2-GAP</name>
              <value column="29" date="2004-10-31T19:56:30" row="06" waferID="PUK444150-03">2.864</value>
         </parameter>
         <parameter>
              <name>RES-LENGTH</name>
              <value column="29" date="2004-10-31T19:56:30" row="06" waferID="PUK444150-03">2.864</value>
         </parameter>
    Is there anyway i can get a list of nodes that match a certain pattern say where name=M2* ?
    I cant seem to find any information where i can match a regular expression. I see how you can do:
    String expression=/parameter[@name='M2-LENG']/value/text()";
    NodeList nodes = (NodeList) xPath.evaluate(expression, inputSource, XPathConstants.NODESET);
    But i want to be able to say:
    String expression=/parameter[@name='M2-*']/value/text()";
    Is this possible? if so how can i do this?
    Thanks!

    As implemented in Java, XPath does not support regular expressions, but in most cases there are workarounds thanks to XPath functions. Correct me if I'm wrong, but setting your expression against the XML document (i.e. because there are no "name" attributes in the whole document) I think you mean to get the value of the <value> elements that have a <parameter> parent element and a <name> sibling element whose value starts with "M2-". If that is the case, you can use the following query expression:String expression = "//parameter/value[substring(../name,1,3)='M2-']";Sorry if I misunderstood the meaning of your expression, but I hope this will help you get the hang of using XPath functions as a substitute for regular expressions.

  • Pattern and Matcher of Regular Expressions

    Hello All,
    MTMISRVLGLIRDQAISTTFGANAVTDAFWVAFRIPNFLRRLFAEGSFATAFVPVFTEVK
    ETRPHADLRELMARVSGTLGGMLLLITALGLIFTPQLAAVFSDGAATNPEKYGLLVDLLR
    LTFPFLLFVSLTALAGGALNSFQRFAIPALTPVILNLCMIAGALWLAPRLEVPILALGWA
    VLVAGALQLLFQLPALKGIDLLTLPRWGWNHPDVRKVLTLMIPTLFGSSIAQINLMLDTV
    IAARLADGSQSWLSLADRFLELPLGVFGVALGTVILPALARHHVKTDRSAFSGALDWGFR
    TTLLIAMPAMLGLLLLAEPLVATLFQYRQFTAFDTRMTAMSVYGLSFGLPAYAMLKVLLP
    I need some help with the regular expressions in java.
    I have encountered a problem on how to retrieve two strings with Pattern and Matcher.
    I have written this code to match one substring"MTMISRVLGLIRDQ", but I want to match multiple substrings in a string.
    Pattern findstring = Pattern.compile("MTMISRVLGLIRDQ");
    Matcher m = findstring.matcher(S);
    while (m.find())
    outputStream.println("Selected Sequence \"" + m.group() +
    "\" starting at index " + m.start() +
    " and ending at index " m.end() ".");
    Any help would be appreciated.

    Double post: http://forum.java.sun.com/thread.jspa?threadID=726158&tstart=0

  • I guess there are not phone support...  I cannot drag images from grid view into collections.

    I have been trying desperately to fix this issue.  I cannot drag any images from the grid view into collections.  Can anyone help?  I looked everywhere for a  customer support number but I was not able to find one on Adobe Website. 

    Hi,
    Only a couple of things I can think of:
    1. Make sure it isn't a Smart Collection, and
    2. Drag by placing the cursor on the actual picture NOT the grey area surrounding the image.

  • Can't import emails from outlook express into mail

    Just bought a macbook, I'm new into MAC, I'm a MAC ROOKIE. I'm trying to import my email from my microsoft outlook express to my MAC MAIL, I followed the instructions to import from outlook but when I locate the outlook files for my emails (they have extension .dbx but it won't let me select the files. Besides in the outlook folder there are dozens of files (1 per email subfolder). What am I doing wrong that I can't import the emails, nor the address book?
    Thxs!!!
    Avecesar

    Pay attention to the information Mail displays during the import process. It could be that it wants you to select the folder that contains the files to be imported, rather than the files themselves.
    EDITED: Now that I've read your post again, I don't think you're going to be able to do this on your MacBook, as importing from Outlook Express requires that application to be running in the "Classic" environment, which isn't available for Intel-based Macs.
    Disclaimer: I know next to nothing about how importing from Outlook Express is supposed to work, so take what I say with a grain of salt.

  • Importing eMail from Outlook Express into OS X Tiger mail

    Am in the process of installing OS X Tiger on a G4 eMac for my wife, who is currently using Outlook Express on an older G3 iMac running OS 9.2.
    I would like to be able to import her existing Mail Boxes from OE on the old iMac to Mail on the eMac.
    Can anyone indicate which files must be transferred from the iMac to the eMac in order for me to import them into Mail ?
    Any help would be appreciated.
    benrobe
    Power Mac G4 Quick Silver 800   Mac OS X (10.4.8)   Reasonable/Good Mac Experience

    Transferred using Ethernet

  • String.matches() question - regular expression help

    How come the following code's if condition returns false?
    String someFile="Dr. Phil.pdf";
    if (someFile.matches("[.][Pp][Dd][Ff]$")) {
      System.out.println("File is a pdf file.");
    }When I change the the matches method to matches(".*[Pp][Dd][Ff]$") it works, so does that mean it has to match the entire string to return true? If so, how can I determine if a partial match occured?
    If partial matching isn't feasible, then can someone help me look determine if this is the best matching pattern to use:
    matches(".*[.][Pp][Dd][Ff]$")Thanks.

    The documentation is your friend.
    [String.matches(regex)|http://java.sun.com/javase/6/docs/api/java/lang/String.html#matches(java.lang.String)] says:
    An invocation of this method of the form str.matches(regex) yields exactly the same result as the expression
    Pattern.matches(regex, str)And [Pattern.matches(regex, str)|http://java.sun.com/javase/6/docs/api/java/util/regex/Pattern.html#matches(java.lang.String, java.lang.CharSequence)] says
    behaves in exactly the same way as the expression
    Pattern.compile(regex).matcher(input).matches()And [Matcher.matches()|http://java.sun.com/javase/6/docs/api/java/util/regex/Matcher.html#matches()] says
    Attempts to match the entire region against the pattern.

  • REGEX: question about finding Overlapping matches using regular expressions

    I have the following problem.
    Say for my pattern I use:
    Pattern pattern = Pattern.compile("AAA");
    Matcher matcher = pattern.matcher("AAAAAA");when I run a loop
    while (matcher.find())
    System.out.println("Match Found: "+matcher.start()+" "+matcher.end());I get 2 Hits shown in the following output:
    Match Found: 0 3
    Match Found: 3 6
    therefore the regex is seeing the first AAA then the second AAA.
    I want it to find the other AAA's in there that are overlapping the other two finds i.e. I want the output to find
    AAA from 0 to 3
    AAA from 1 to 4
    AAA from 2 to 5 and finally
    AAA from 3 to 6
    thereby including the overlapping finds.
    How can I do this using regex? what am I missing that prevents the overlapping matches to be found? Do I need a quantifier?
    Thanks for the help!

    While the solutions above work fine with the given input, they don't really find all overlapping matches. They just find the longest possible match at each start position. Here's a more thorough approach:import java.util.*;
    import java.util.regex.*;
    public class Test
      public static List<String> matchAllWays(String rgx, String str)
        Pattern p = Pattern.compile(rgx);
        Matcher m = p.matcher(str);
        List<String> result = new ArrayList<String>();
        int len = str.length();
        int start = 0;
        int end = len;
        while (start < len && m.region(start, len).find())
          start = m.start();
          do
            result.add(m.group());
            end = m.end() - 1;
          } while (end > start && m.region(start, end).find());
          start++;
        return result;
      public static void main(String[] args)
        List<String> matches = matchAllWays("a.*a", "abracadabra");
        System.out.println(matches);
    }This approach requires JDK 1.5 or later; that's when the regions API was added to Matcher.

  • MATCH COUNT Regular expression

    Hello,
    does anybody know why these statements return mcount = 1 and not mcount = 4???
    FIND 'a' IN 'aabaa' MATCH COUNT mcount.
    FIND REGEX 'a+' IN 'aabaa' MATCH COUNT mcount.
    Thank you
    Manuel

    Try adding option  "ALL OCCURRENCES" to yur example.
    Best!
    Jim

  • Cannot get regular expression to return true in String.matches()

    Hi,
    My String that I'm attempting to match a regular expression against is: value=='ORIG')
    My regular expression is: value=='ORIG'\\) The double backslashes are included as a delimiter for ')' which is a regular expression special character
    However, when I call the String.matches() method for this regular expression it returns false. Where am I going wrong?
    Thanks.

    The string doesn't contain what you think it contains, or you made a mistake in your implementation.
    public class Bar {
       public static void main(final String... args) {
          final String s = "value=='ORIG')";
          System.out.println(s.matches("value=='ORIG'\\)")); // Prints "true"
    }

  • Regular expressions and sql

    I have working regular expressions and a working sql connection, but I don�t know how to stop the info from getting into the database when input doesent match the regular expression.
    For instans, you put in an e-mail without an "@" and my program writes and error message. But the info still gets in to the database.
    Any help would be much apreciated as I dont know where to start. If you have links or code examples that would be great to.
    Thanx.

    Well, the obvious answer is "only write the data to the database if the input doesn't match the regular expression."
    Presumably you're really asking how to do that - but it depends upon how your application is structured in the first place, and you haven't told us anything at all about that.

  • Regular expressions in Format Definition add-on

    Hello experts,
    I have a question about regular expressions. I am a newbie in regular expressions and I could use some help on this one. I tried some 6 hours, but I can't get solve it myself.
    Summary of my problem:
    In SAP Business One (patch level 42) it is possible to use bank statement processing. A file (full of regular expressions) is to be selected, so it can match certain criteria to the bank statement file. The bank statement file consists of a certain pattern (look at the attached code snippet).
    :61:071222D208,00N026
    :86:P  12345678BELASTINGDIENST       F8R03782497                $GH
    $0000009                         BETALINGSKENM. 123456789123456
    0 1234567891234560                                            
    :61:071225C758,70N078
    :86:0116664495 REGULA B.V. HELPMESTRAAT 243 B 5371 AM HARDCITY HARD
    CITY 48772-54314                                                  
    :61:071225C425,05N078
    :86:0329883585 J. MANSSHOT PATTRIOTISLAND 38 1996 PT HELMEN BIJBETA
    LING VOOR RELOOP RMP1 SET ORDERNR* 69866 / SPOEDIG LEVEREN    
    :61:071225C850,00N078
    :86:0105327212 POSE TELEFOONSTRAAT 43 6448 SL S-ROTTERDAM MIJN OR
    DERNR. 53846 REF. MAIL 21-02
    - I am in search of the right type of regular expression that is used by the Format Definition add-on (javascript, .NET, perl, JAVA, python, etc.)
    Besides that I need the regular expressions below, so the Format Definition will match the right lines from my bankfile.
    - a regular expression that selects lines starting with :61: and line :86: including next lines (if available), so in fact it has to select everything from :86: till :61: again.
    - a regular expression that selects the bank account number (position 5-14) from lines starting with :86:
    - a regular expression that selects all other info from lines starting with :86: (and following if any), so all positions that follow after the bank account number
    I am looking forward to the right solutions, I can give more info if you need any.

    Hello Hendri,
    Q1:I am in search of the right type of regular expression that is used by the Format Definition add-on (javascript, .NET, perl, JAVA, pythonetc.)
    Answer: Format Definition uses .Net regular expression.
    You may refer the following examples. If necessary, I can send you a guide about how to use regular expression in Format Defnition. Thanks.
    Example 6
    Description:
    To match a field with an optional field in front. For example, u201C:61:0711211121C216,08N051NONREFu201D or u201C:61:071121C216,08N051NONREFu201D, which comprises of a record identification u201C:61:u201D, a date in the form of YYMMDD, anther optional date MMDD, one or two characters to signify the direction of money flow, a numeric amount value and some other information. The target to be matched is the numeric amount value.
    Regular expression:
    (?<=:61:\d(\d)?[a-zA-Z]{1,2})((\d(,\d*)?)|(,\d))
    Text:
    :61:0711211121C216,08N051NONREF
    Matches:
    1
    Tips:
    1.     All the fields in front of the target field are described in the look behind assertion embraced by (?<= and ). Especially, the optional field is embraced by parentheses and then a u201C?u201D  (question mark). The sub expression for amount is copied from example 1. You can compose your own regular expression for such cases in the form of (?<=REGEX_FOR_FIELDS_IN_FRONT)(REGEX_FOR_TARGET_FIELD), in which REGEX_FOR_FIELDS_IN_FRONT and REGEX_FOR_TARGET_FIELD are respectively the regular expression for the fields in front and the target field. Keep the parentheses therein.
    Example 7
    Description:
    Find all numbers in the free text description, which are possibly document identifications, e.g. for invoices
    Regular expression:
    (?<=\b)(?<!\.)\d+(?=\b)(?!\.)
    Text:
    :86:GIRO  6890316
    ENERGETICA NATURA BENELU
    AFRIKAWEG 14
    HULST
    3187-A1176
    TRANSACTIEDATUM* 03-07-2007
    Matches:
    6
    Tips:
    1.     The regular expression given finds all digits between word boundaries except those with a prior dot or following dot; u201C.u201D (dot) is escaped as \.
    2.     It may find out some inaccurate matches, like the date in text. If you want to exclude u201C-u201D (hyphen) as prior or following character, resemble the case for u201C.u201D (dot), the regular expression becomes (?<=\b)(?<!\.)(?<!-)\d+(?=\b)(?!\.)(?!-). The matches will be:
    :86:GIRO  6890316
    ENERGETICA NATURA BENELU
    AFRIKAWEG 14
    HULST
    3187-A1176
    TRANSACTIEDATUM* 03-07-2007
    You may lose some real values like u201C3187u201D before the u201C-u201D.
    Example 8
    Description:
    Find BP account number in 9 digits with a prior u201CPu201D or u201C0u201D in the first position of free text description
    Regular expression:
    (?<=^(P|0))\d
    Text:
    0000006681 FORTIS ASR BETALINGSCENTRUM BV
    Matches:
    1
    Tips:
    1.     Use positive look behind assertion (?<=PRIOR_KEYWORD) to express the prior keyword.
    2.     u201C^u201D stands for that match starts from the beginning of the text. If the text includes the record identification, you may include it also in the look behind assertion. For example,
    :86:0000006681 FORTIS ASR BETALINGSCENTRUM BV
    The regular expression becomes
    (?<=:86:(P|0))\d
    Example 9
    Description:
    Following example 8, to find the possible BP name after BP account number, which is composed of letter, dot or space.
    Regular expression:
    (?<=^(P|0)\d)[a-zA-Z. ]*
    Text:
    0000006681 FORTIS ASR BETALINGSCENTRUM BV
    Matches:
    1
    Tips:
    1.     In this case, put BP account number regular expression into the look behind assertion.
    Example 10
    Description:
    Find the possible document identifications in a sub-record of :86: record. Sub-record is like u201C?00u201D, u201C?10u201D etc.  A possible document identification sub-record is made up of the following parts:
    u2022     keyword u201CREu201D, u201CRGu201D, u201CRu201D, u201CINVu201D, u201CNRu201D, u201CNOu201D, u201CRECHNu201D or u201CRECHNUNGu201D, and
    u2022     an optional group made up of following:
         a separator of either a dot, hyphen or slash, and
         an optional space, and
         an optional string starting with keyword u201CNRu201D or u201CNOu201D followed by a separator of either a dot, hyphen or slash, and
         an optional space
    u2022     and finally document identification in digits
    Regular expression:
    (?<=\?\d(RE|RG|R|INV|NR|NO|RECHN|RECHNUNG)((\.|-|/)\s?((NR|NO)(\.|-|/))?\s?)?)\d+
    Kind Regards
    -Yatsea

  • Regular expressions and backreference

    Hello!
    I am trying to use backreferences in REGEXP in the PERL-style, where I want to match my regular expression and later refer to the grouped values. I can read that those are referecenced with \1 .. \9, but I simply cant get it to work. Here is an example in PL/SQL:
    SELECT REGEXP_SUBSTR(l_users.adresse,'([A-Z]+)\s+(\d+)')
    INTO l_dummy_varchar2
    FROM dual;
    OR I could do things like:
    l_dummy_varchar2 := REGEXP_SUBSTR(l_users.adresse,'([A-Z]+)\s+(\d+)');
    It seems to work, but I cant figure out how to get the backreferenced value.
    I would love to do things like:
    dbms_output.put_line('my value ='||\1)
    but this doesnt work.
    Help is very much appreciated.
    Best regards
    Dannie

    Likewise you can extract things using the
    REGEXP_SUBSTR, but you don't need back
    referencing...backreferencing is better than additional function (ltrim) use, and BTW be careful with this "ltrims":
    SQL> set serveroutput on
    SQL>
    SQL> DECLARE
      2       v_txt VARCHAR2(100);
      3     BEGIN
      4       v_txt := ltrim(regexp_substr('HERE IS AN ASCII CHARACTER', 'IS AN [[:alnum:]]*'),'IS AN ');
      5       DBMS_OUTPUT.PUT_LINE('Word after IS AN: '||v_txt);
      6  END;
      7  /
    Word after IS AN: CII
    PL/SQL procedure successfully completed
    SQL>
    SQL> DECLARE
      2       v_txt VARCHAR2(100);
      3     BEGIN
      4       v_txt := regexp_replace('HERE IS AN ASCII CHARACTER', 'IS AN ([[:alnum:]]*)|.','\1');
      5       DBMS_OUTPUT.PUT_LINE('Word after IS AN: '||v_txt);
      6  END;
      7  /
    Word after IS AN: ASCII
    PL/SQL procedure successfully completed
    SQL> -----------
    VB
    http://volder-notes.blogspot.com/

Maybe you are looking for