Use REGEXP_REPLACE as advanced initcap function?

Hi,
I wan't to convert a string "bygger'n" to "Bygger'n", is it possible to do something like this with regexp_replace?
"bygger'n" is just meant as an example, I want to replace all matching patterns with lowercase letters.
Oracle does not seem to consider lower/upper-functions for the replace of patterns:
SQL> select regexp_replace(initcap('bygger''n'), '(''[[:alnum:]])', lower('\1')) try_lower
  2  ,      regexp_replace(initcap('bygger''n'), '(''[[:alnum:]])', ' \1 ') spaces
  3  from   dual
  4  /
TRY_LOWE SPACES
Bygger'N Bygger 'NRegards
Haavard

If you are on 10g you can do it with a Java Stored Procedure that handles regular expressions with a powerful API. Take a look at the Matcher class.
http://www.regular-expressions.info/java.html
http://www.javaworld.com/javaworld/jw-02-2003/jw-0207-java101.html
create or replace java source named MyInitcap as
import java.util.regex.*;
class MyInitcap {
     public static String firstUpper(String s) {
          return Character.toUpperCase(s.charAt(0))+s.substring(1).toLowerCase();
     public static String initcap(String input) {
          Pattern p = Pattern.compile ("((\\w|')+)");
          Matcher m = p.matcher (input);
          StringBuffer sb = new StringBuffer ();
          while (m.find ())
               m.appendReplacement (sb, firstUpper(m.group()));
          m.appendTail (sb);
          return sb.toString();
create or replace function my_initcap (
          string in varchar2
     )return varchar2
as language java name 'MyInitcap.initcap(java.lang.String) return java.lang.String';
/And then
Processing ...
with t as (select 'FIRSTNAME O''MALLEY' col1
             from dual
            union
           select 'FIRST''NAME  TEH''TE'
             from dual
            union
           select 'FORMAT ME BYGGER''N'
             from dual
            union
           select 'OLD MCDONALD'
             from dual
            union
           select 'EVEN OL''DER MACDONALD'
             from dual
select t.col1 source
     , my_initcap(col1) formatted
  from t
Query finished, retrieving results...
        SOURCE              FORMATTED                                   
EVEN OL'DER MACDONALD Even Ol'der Macdonald  
FIRST'NAME  TEH'TE    First'name  Teh'te    
FIRSTNAME O'MALLEY    Firstname O'malley     
FORMAT ME BYGGER'N    Format Me Bygger'n     
OLD MCDONALD          Old Mcdonald          
5 row(s) retrievedBye Alessandro

Similar Messages

  • How to use  Advance java function in graphical mapping in XI 2.0?

    Hi,
    currently I am using a simple java function to make an RFC call to R3 system.
    I want to avoid making connection for each lookup. Instead I want to make a single connection for whole message queue and get the corresponding values in some array or container object.
    please suggest a solution.
    I think this is possible using Advance java function, but I am not able to find any example on using Advance java function at help.sap.com.
    thaks in advance.

    Hi!!!
    I'm not sure if I understood you well.
    Do you want to preload some data into your structures in the memory and keep them there so you don't need to make a new connection during processing the whole message or every message?
    In my opinion you can cache some data during processing a message, but it's impossible to cache some data between processing messages.
    If you write your java mapping or you use graphical mapping (even with user-defined function), then you have a java class. The problem is that XI 2.0 reloads this class during processing every message, so even if you load some data from your data source into your structures in the memory, this data will be lost after reloading your mapping class.
    Regards,
    Andrzej Filusz

  • Using advanced statistical functions in BO or creating your own ones

    Hello,
    Can someone tell me if it is possible to use more advanced statistical functions in BO (webi or deski f.i.) like the possibility to extrapolate figures. I only see a limited functions in Webi (mean, intrapolate, percentiles, ...).
    If not is it then possible to add own functions in the available functions?
    many regards

    I believe there are more possibilities in WEbi 4.O

  • Alternate without using regexp_replace function

    SELECT
      REGEXP_REPLACE(phone_number,
                     '([[:digit:]]{3})\.([[:digit:]]{3})\.([[:digit:]]{4})',
                     '(\1) \2-\3') "REGEXP_REPLACE"
                     FROM employees;
    is there any alternate without using regexp_replace function.........

    Another way
    (eliminating instr function.. as your problem focusses on a fixed length)
    WITH t AS (SELECT '112.345.6789' str FROM DUAL),
         tt AS (SELECT REPLACE (str, '.') str FROM t)
    SELECT    '('
           || SUBSTR (str, 1, 3)
           || ') '
           || SUBSTR (str, 4, 3)
           || '-'
           || SUBSTR (str, 7)
      FROM tt;
    Cheers,
    Manik.

  • How can I use Automator to toggle the Function Keys?

    I am trying to create a Automated process to toggle the Function Keys on my keyboard. This is because I use several programs, including After Effects, which use the F1-12 keys, but when I am not using that program I commonly use the Apple-defined shortcuts on the keyboard. I have a full-sized keyboard, hence no Fn key. So that's out right away – I've read several comments on this topic where people suggested that this is the ONLY option. I refuse to beleive that.
    Automator contains a "Watch Me Do" feature, which I have tried to use to record this process. Problem is, it never clicks the right object. If I record clicking the dock, the magnification (I suspect) throws off the virtual-controlled mouse and picks the wrong object. If I record the Apple Menu route, it gets it about 1/2 the time.
    I think what I'm really looking for is a console command I can feed into the Terminal which toggles the keys. It seems to be that this HAS to be an option, even if it is more than one line of commands. I believe if I can feed this process into Automator, it would work.
    Any ideas?
    Thanks in advance, Mac Geniuses!

    iKey lets you define function keys per application. You seem to want to turn on & off the defined apple keys.  Not sure if these keyboard re-mappers will do the trick.
    Here is my other most favored application. Of course, I haven't checked these out in newer OS's. I'm a Tiger man myself.
    iKey is a front end program that simulates typing and mouse movements. I use iKey to remap the Function keys.
    "iKey is an automation utility, a program that creates shortcuts to accomplish repetitive tasks. In essence, an iKey shortcut is a little program in its own right, but you don't need to know the first thing about programming to create an iKey shortcut. All you have to do is put together three necessary parts of a shortcut: One or more commands that give the shortcut its functionality, a context in which it runs, and a launcher that defines how the shortcut is activated."
    http://www.scriptsoftware.com/ikey/
    iKey  has a little more function then the previous free version called youpi key. For many years, I used youpi key before switching to iKey.  It works fairly well for me in MAC OS 10.4 although not officially supported.  The youpi key download is hard to find & no longer here.
    http://www.versiontracker.com/dyn/moreinfo/macosx/11485&vid=75326
    ( Send me a message for a copy of youpi  key. )
    *Examples:*
    I have the common programs that I use assigned to function keys. I have F4 assigned to Firefox. When I want to start FireFox, I press F4. When I want to switch to firefox, I press F4! Starting & switching to an application in Mac OS are the same thing in Mac OS.
    Here is an example of to assign volumn control to a function key.
    http://discussions.apple.com/message.jspa?messageID=10361085#10361085
    Here is my script for listing my application folder. I have it assigned to function-key 6.
    tell application "Finder"
       open folder "Applications" of startup disk
       select Finder window 1
       set bounds of Finder window 1 to {-3, 44, 691, 545}
       --set position of Finder window 1 to {33, 44}
       set position of Finder window 1 to {60, 45}
       activate
    end tell
    The second portion of this script was generated in the script editor record mode. After I recorded the script and did some editing, I copy the script to ikey/youpi key.
    Full Key Codes
    http://download.cnet.com/Full-Key-Codes/3000-2094_4-44175.html
    Spark
    "Spark is a powerful, and easy Shortcuts manager. With Spark you can create Hot Keys to launch applications and documents, execute AppleScript, command iTunes, and more... You can also export and import your Hot Keys library, or save it in HTML format to print it. Spark is free, so use it without moderation!"
    http://www.versiontracker.com/dyn/moreinfo/macosx/22675
    Mac OS X remap or rename keyboard keys
    by vivek
    So how do you remap or rename keyboard keys under Mac OS X?
    Simply use DoubleCommand software.  It is a free program
    http://theos.in/apple/download-doublecommand-to-remap-keyboard-keys/
    Keyboard Maestro is a powerful macro program for Mac OS X (including Tiger and Leopard) which has received glowing reviews. Keyboard Maestro will take your Macintosh experience to a new level in “Ease of Use”. With Keyboard Maestro you can design a custom action sequence with your own shortcuts and use them at any time, you can navigate through running applications and open windows with Program Switcher, and you can work with an unlimited number of clipboards - all by pressing simple keystrokes.
    http://www.keyboardmaestro.com/main/
    "Spark is a powerful, and easy Shortcuts manager. With Spark you can create Hot Keys to launch applications and documents, execute AppleScript, command iTunes, and more... You can also export and import your Hot Keys library, or save it in HTML format to print it. Spark is free, so use it without moderation"
    http://www.versiontracker.com/dyn/moreinfo/macosx/22675

  • Need an example how to use SCAN_Start with a callback function

    I would appreciate if someone helps me with a working example of how to use SCAN_Start with a callback function. I need just a basic functionality: to specify a channel list (with gains probably), to start a data acquisition task and to receive data buffers utilizing a callback function. t this time whatever I was trying to do caused computer hangups, though it is supposed to be one of the most regular tasks to perform.
    Thank you in advance,
    Mike

    Hello Mike,
    Thank you for contacting National Instruments.
    Attached is an example project which uses a callback function to begin analog acquisition (AI) by calling SCAN_Start. This project acquires from the first 2 channels on your DAQ device. Make sure to modify the device number in the code to match the number of your card.
    Let me know if you have any further questions...
    Sincerely,
    Sean C.
    Applcications Engineer
    National Instruments
    Attachments:
    Acquire_multichannel_61xx.zip ‏11 KB

  • Initcap function Problem In RTF

    Hhi all I want to print the starting letter of each word of a field in rtf as capital so am using as
    <?xdofx:initcap(field name)?>
    but it is not displaying any out put .
    and for lower it is working fine .Kindly help me .
    THanks for all in advance.

    i have a suggestion that there is a problem with colspan parameter in xml file that is built when HP starts creating pdf report, could anybody advise where i can find this xml that is used for creating report?
    Edited by: s0uLr1pPeR on 18.05.2012 16:31

  • LabVIEW 8.5 and building executable (using fxs from Advanced Signal Processing Toolkit)

    Hello out there to NI and Gavin:
    For for building an executable using LabVIEW 8.5 and functions from the
    Advanced Signal Processing toolkit, do we still need to manually copy the
    special set of DLLs related to the toolkit use to the target installation, or are these now included
    within a build file for automatic installation to the target
    installation?
    Thanks,
    Don

    Hi Don,
    I imagine that any improvements made to steps required to build an executable using toolkit-specific vi's would be inherent of the toolkit itself. Meaning, I imagine the inconvenience you experienced would be eliminated with the next release of the Advanced Signal Processing Toolkit.
    Cheers,
    Emilie K. | Applications Engineer

  • Adobe Advanced Search Function not woking

    The Advanced Search Function has stopped working. I use mac os x 10.6.8. I deleted and reinstalled adobe reader 10.1.2 and still the same problem: nothing appears when I click on the Advanced Search function. I'd welcome suggestions on how to fix this. Thank you.

    Did you try the shortcut for Advanced search - option + shift +F. Do you not get the search window even then ?

  • Referencing REGEXP_REPLACE capture in other function

    Here's the deal...
    I've got a clob that I'm scrubbing with REGEXP_REPLACE to remove the instance of a specific string, then I want to use that string in a function call. I can see the string (on line 2 below) but can't get the function in line 3 to utilize it.
    THE CODE
    1 SELECT regexp_replace(wrk_clob, 'href=\s*"([^"]+)"',
    2                    || '\1' || ':'
    3                    || get_id_list(in_table, in_state, '\1')
    4 INTO wrk_clob
    5 FROM dual;
    THE FUNCTION SPEC
    FUNCTION get_id_list(
                   in_table VARCHAR2,
                   in_state VARCHAR2,
                   in_doc_name VARCHAR2)
                             RETURN VARCHAR;
    If I hardcode the value from line 4 into the in_doc_name position it returns properly. However, it does nothing - because '\1' does not point to any data - with this reference.
    Any ideas where to go with this?
    Thanks.
    fordo82

    Look here:
    SQL> with t as (select '"111111" href="111"222' str from dual)
      2  select regexp_replace(str, 'href=\s*"([^"]+)"', '\1:'||decode(1,2,'asd','qwe')) yours,
      3         regexp_replace(str, 'href=\s*"([^"]+)"', '\1') yours2,
      4         regexp_replace(str, '.*?href=\s*"([^"]+)".*', '\1') mine,
      5         regexp_substr(str, 'href=\s*"([^"]+)"') subs1
      6          from t
      7  /
    YOURS               YOURS2          MINE SUBS1
    "111111" 111:qwe222 "111111" 111222 111  href="111"
    SQL> If any questions rest - ask.
    Message was edited by:
    Volder
    Whereas the piece that I have currently - regexp_replace(wrk_clob, 'href=\s*"([^"]+)"', - will cut out what the pieces I don't want.Can you provide an example of wrk_clob, and the result - you expect to get with this regexp_replace?

  • Advanced File Functions

    Hello all,
    I have a subVI that deletes 5 files which should always be present on my desktop due to a run before.  However, I have to put in a fail-safe that skips the delete process if the files are for some reason missing.
    Attached is the simple file path constant and Delete file directory process that I currently use.
    Is there any way I can utilize any of the other Advanced File Functions with a Case Structure and other Boolean Functions that can detect whether or not the files are there and then delete them if they are, or just skip the delete process if the files are not there.
    Thanks
    Attachments:
    Delete Files.vi ‏16 KB

    The Delete VI will skip the process on its own. The simplest thing to do is to call it and ignore the error (for example by using the Clear Errors VI). Just make sure not to wire an error into it if you do this, because you will then clear that error.
    As for some other tips regarding this VIs -
    Using constant paths is often a bad thing, especially if your are going to build the code into an executable and\or move it to another computer. Getting the path to the desktop is done in Windows through a special function which you can call by using the Call Library Function node, or you can hold the base path in a global.
    I suggest that unless absolutely necessary, you should not save your files to the desktop, but to another folder.
    You should create error in and out terminals, so that you can control when the VI runs.
    Giving it a less generic name is also a good idea, because LV can not hold 2 VIs with the same name in memory.
    To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here, here, here, here and here are a few you can start with and here are some tutorial videos. You can also contact your local NI office and join one of their courses.
    In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).
    Try to take over the world!

  • Passing regexp_replace backreference to a function; type conversion problem

    I am trying to convert some text within my CLOB field to HTML links.
    The format of the (part of the link I am having problems with) is:
    <link 12>
    which I wish to convert to
    url_dest
    I am trying to pass the backreference \1 (being the number 12 in this case) in regexp_replace to a simple function I have made and when I run it I receive the error:
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    I have tested the function on its own with passing a string and it works fine.
    I have passed the string from the backreference to the function and back out as the return value and it works fine.
    However, when I try to pass the string back reference (a set of digits) to use as the NUMBER ID in my where clause, it always returns this error. I have tried CASTing / TO_NUMBER in every way possible I can think of, using temporary variables etc. and still the same error.
    =====
    CREATE OR REPLACE
    FUNCTION GETLINK (linkid IN CLOB)
    RETURN VARCHAR2 AS
    linkstring VARCHAR2(4000);
    linkchar VARCHAR(4000);
    linkint NUMBER;
    BEGIN
    linkchar := TO_CHAR(linkid);
    linkint := TO_NUMBER(linkchar);
    SELECT url_dest INTO linkstring FROM TABLE WHERE ID = linkint;
    RETURN linkstring;
    END;
    =====
    Offending calling code:
    tempcontent := regexp_replace(myClobField, '<link ([[:digit:]]*)>', GETLINK('\1'));
    =====
    I have tried implicit and explicit type conversions that vary the above function; in parameters as VARCHAR2; etc.; no joy.
    Is this a bug within the database, is it by design, or is it just me making a hash of things? I really don't want to have to pull the XML into PHP then run the PHP regex functions with Oracle DB queries to do this!
    Many thanks for your assistance.
    Ingram

    Many thanks for the reply, but I'm not sure how that would work. I wish to do a global regexp_replace on all instances of '<link> ([[:digit:]]*)>' within my XML document, with the return value from the GETLINK function.
    So for instance.
    The return value of GETLINK could be in format:
    &lt;a href="\1"&gt;
    so an XML document of:
    =====
    &lt;doc&gt;
    &lt;link 12&gt;Test Link&lt;/link&gt;
    some content
    &lt;link 783&gt;A second Test Link&lt;/link&gt;
    &lt;/doc&gt;
    =====
    would return as:
    =====
    &lt;doc>
    &lt;a href="12"&gt;Test Link&lt;/link&gt;
    some content
    &lt;a href="783"&gt;A second Test Link&lt;/link&gt;
    &lt;/doc&gt;
    =====
    Obviously I would then do the other replacements to fix broken XML with the non matching end tags etc.
    TIA

  • Can Advanced Action functions be done with JS?

    Is it possible to use JavaScript to perform Advanced Action functions like "show", "hide", "assign", etc? If so, is there an applicable reference doc?
    Thanks,
    Bob

    The SWF JS API does not support show/hide... only assign.  HTML5 JS API supports show/hide and assign.
    To assign a vairable regardless of Output, you can look at this article:
    http://captivatedev.com/2012/12/17/display-the-students-name-from-your-lms-using-adobe-cap tivate-6-x/
    If you want to show/hide in HTML5, you can use
    cp.hide("ItemNameHere");
    cp.show("ItemNameHere");

  • Advance payment functionality

    Hi Gurus,
    Can any one please explain me if the way the advance payment functionality is used in the SAP system? The advance payment can be from 10% to 100%, I will I have to have the separate way of posting or do I create a new GL account? I will appriciate if some one can explain me this in details.
    Thanks and regards
    Anoop

    Hi
    SAP is using advance payment functionally as Advance payment to vendor. You have to maintain G/L account for this

  • How to use a mysql built-in function with dataprovider

    hi.
    I want to use a mysql built-in function, for example, MD5() on a column when updating a table with dataprovider.
    Something like this doesn't work:
    MyDataProviderOne.setValue("tablename.field_name", "MD5('some text')");
    How should it be done?
    thanks.
    Mike.

    hi.
    thanks. this helped, but I'd like to use also different functions, that's why, I'd rather do it by MySQL built-in functions with dataprovider... Is there any way to do that?
    best regards.
    Mike.

Maybe you are looking for

  • Airport Utility not always recognizing Airport Extreme

    I recently bought a new Airport Extreme so I could connect wirelessly to my iTunes library (which is too big to fit on my hard drive) and stream music to my receiver. I hooked up a USB external drive with my library on it to the Airport Extreme and I

  • Error While Installing ABAP Netweaver Trail

    Hi Everyone, I am New to this network, Can anyone please help me, when i am installing SAP_NetWeaver_702e_Installation_Master Trail I am getting this error. How to resolve this issue? An error occurred while processing option SAP NetWeaver 7.0 includ

  • Is SSO possible for SAP ERP and xMII

    Hi, Is it possible to have Single Sign-On between SAP ERP and xMII. The requirement is that the user wants to login to the SAP ERP and using the same credentials he/she should be able to use xMII (without prompting for login credentials again.) If it

  • Single Page View

    How do I set the PDF so when it opens you see the entire page rather than only the top half zoomed up?

  • I cannot open visualizer in window mode for the new version of iTunes 11.0.

    Hi, I used to turn on the visualizer in window mode. But since I updated to iTunes 11.0, the visualizer can only be turned on in full screen mode. People said that double-click on a playlist or right-click to show "open in a new window" should work.