Replacing unauthorized characters with space

Hi friends,
There is a set of authorized characters. The authorized characters are
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789<space>
If any character other than these characters should be replaced with space.
For example, "I like foot-ball" should be changed to "I like foot ball"
"Where are you?" should be changed to "Where are you"
"red / blue" should be changed to "red   blue"
I use Oracle 11.2.
Thanks in advance!

Using regular expression you can do this.
SQL> with t
  2  as
  3  (
  4  select 'I like foot-ball' str
  5    from dual
  6  )
  7  select str
  8       , regexp_replace(str, '[^a-z0-9[:space:]]', ' ', 1, 0, 'i') new_str
  9    from t;
STR              NEW_STR
I like foot-ball I like foot ball
You can read more about regular expression from the document.
Using Regular Expressions in Oracle Database
Message was edited by: Karthick_Arp
Edited the Pattern after seeing franks post.

Similar Messages

  • How can I calculate the characters with spaces in a document on pages

    I'm currently using pages to write my personal statement up on, although i need to keep my characters including spaces under 4000 characters and also have no more than 47 lines. I've found how to do a word count and find how many charcaters I've used, but i can't see anywhere the information that I actually need to find! Someone please help, thankyou

    How can you calculate the number of lines if you don't know how many characters there are to a line?
    This is 2013. We are using word processors with real fonts, not terminals or teletypers or typewriters.
    If you must have 47 lines then shrink the point size of the font until it fits.
    Peter

  • Does trim replace some characters with control code versions in xml?

    I am using trim to remove extra white space and linefeeds from xml files and it works fine except that occasionally it replaces xml close element symbols (>) with the control code > used to delineate a > symbol that is not to be interpreted as as the xml character. What gives here? I thought all trim did was eliminate leading and trailing characters whose code was greater than '\u0020'.
    I am using Java 1.5 but this happened with 1.4 as well.

    Yes,
                             <md.decideddate>20060612</md.decideddate>
    apparently has the final '>' replaced by &gt.
    This does not happen consistently and can only be seen when loaded to IE. The Framework that I am working with in Websphere sees the error but neither XMLSpy or Eclipse has a problem with the file.
    Here's what I get when I load the file to IE:\
    An invalid character was found in text content. Error processing resource 'file:///C:/Projects/Rex/testdata/input/content/R...
    <md.dates><md.filedate>May 26, 2006</md.filedate><md.decideddate>20060526</md.decideddate&g...
    I find this very strange.

  • Identifying patterns in a string & replacing all characters with 1st digit

    Morning folks. Interesting problem on hand. I have a situation where I have a varchar2 text field where I have different paterns of a sequence of numbers somewhere in the string. I guess, I could write a function where by I accept the whole string and then identify one of the patters below and then finally replace only the recognized pattern with the first digit all the way through to the end of that pattern.
    The catch here is that there could be free text before and after the string but there will be spaces when free text ends and the patern begins.
    Here are a few patterns I would be interested in. The MAX length is 19 as in Cases 1 and 3.
    1. 9999 9999 9999 9999
    2. 9999999999999999
    3. 9999-9999-9999-9999
    4. 9999-9999-99-99999
    5. 9999-999999-99999So, here would be an example of the problem in hand :
    Call received on 9/22/2009.
    5123-4532-8871-9876
    Please follow up by 10/22/2009So, the desired output would be :
    Call received on 9/22/2009.
    5555-5555-5555-5555
    Please follow up by 10/22/2009Any ideas ? I am stumped at the fact of before and after text in the string, hence the question for you guys !
    Thanks !

    Here is another solution. However there has to be a better way! (I'm not a regular expression expert).
    SQL> WITH test_data AS
      2  (
      3          SELECT 'Call received on 9/22/2009.
      4          1232 3456 8765 3456
      5          Please follow up by 10/22/2009' AS DATA FROM DUAL UNION ALL
      6          SELECT 'Call received on 9/22/2009.
      7          1232345687653456
      8          Please follow up by 10/22/2009' AS DATA FROM DUAL UNION ALL
      9          SELECT 'Call received on 9/22/2009.
    10          1232-3456-8765-3456
    11          Please follow up by 10/22/2009' AS DATA FROM DUAL UNION ALL
    12          SELECT 'Call received on 9/22/2009.
    13          1232-3456-86-3456
    14          Please follow up by 10/22/2009' AS DATA FROM DUAL UNION ALL
    15          SELECT 'Call received on 9/22/2009.
    16          1232-345687-3456
    17          Please follow up by 10/22/2009' AS DATA FROM DUAL
    18  ), substring AS
    19  (
    20          SELECT  DATA AS SOURCE
    21          ,       REGEXP_INSTR
    22                  (
    23                          DATA
    24                  ,       '(([[:digit:]])+[[:space:]|-]){1,}'
    25                  ) AS PATSTART
    26          ,       REGEXP_SUBSTR
    27                  (
    28                          DATA
    29                  ,       '(([[:digit:]])+[[:space:]|-]){1,}'
    30                  ) AS PATTERN
    31          ,       19 AS MAXLENGTH
    32          FROM    test_data
    33  )
    34  SELECT  SUBSTR
    35          (
    36                  SOURCE
    37          ,       1
    38          ,       PATSTART-1
    39          ) ||
    40          TRANSLATE
    41          (
    42                  PATTERN
    43          ,       '0123456789'
    44          ,       LPAD
    45                  (
    46                          SUBSTR
    47                          (
    48                                  PATTERN
    49                          ,       1
    50                          ,       1
    51                          )
    52                  ,       10
    53                  ,       SUBSTR
    54                          (
    55                                  PATTERN
    56                          ,       1
    57                          ,       1
    58                          )
    59                  )
    60          ) ||
    61          SUBSTR
    62          (
    63                  SOURCE
    64          ,       PATSTART + MAXLENGTH
    65          )       AS NEW_STRING
    66  FROM substring
    67  /
    NEW_STRING
    Call received on 9/22/2009.
            1111 1111 1111 1111
            Please follow up by 10/22/2009
    Call received on 9/22/2009.
            1111111111111111
          Please follow up by 10/22/2009
    Call received on 9/22/2009.
            1111-1111-1111-1111
            Please follow up by 10/22/2009
    Call received on 9/22/2009.
            1111-1111-11-1111
           Please follow up by 10/22/2009
    Call received on 9/22/2009.
            1111-111111-1111
          Please follow up by 10/22/2009
    SQL>

  • How to replace special characters with html code characters automatically?

    A colleague and I work on these html pages. They eventually end up as emails, but we have the cold fusion server to pre process them. One thing we are trying to do is eliminate problems caused by unencoded copyright, trademark and smart quote symbols.
    How could I create an array of find / replace commands in the header so it processes the HTML with correct character codes.
    I"m not cold fusion aware, so any kind of starter info would be great. Eventually I might add more replacements to the array.
    As an example TM (font character) would process to &trade; and a smart quote or apostrophe would process to a straight one. an en dash character would become &ndash;
    Because we copy paste from places, this often happens and it seems like cold fusion could solve the problem quickly and repeatedly all at once.
    thanks for any help
    -smick

    CF has a built in HTMLEditFormat function for handling <  &  > characters.  For handling trademark and smart quote characters you might try searching for a user defined function at http://cflib.org or writing a user defined function yourself that will handle the specific characters needed in your application.

  • Replacing Special Characters With Its Actual Value

    Hi All,
    Does anyone has any idea how to replace an extended character (ASCII value ranging from 128 to 255) to its actual character set in SQL/PLSQL?
    For example: “½” needs to be replaced to “1/2”
    “¼” needs to be replaced to “1/4”
    Ultimately if the value is “California 71 ½ ” then the result should be “California 71 1/2”.
    Thanks for your time!
    Regards,

    user10088255 wrote:
    Hi All,
    Does anyone has any idea how to replace an extended character (ASCII value ranging from 128 to 255) to its actual character set in SQL/PLSQL?You can also use POSIX Character Equivalence Class to match characters having the same base character as the character you specify.
    --Extended ASCII (ISO Latin-1):
    á     #225
    â     #226
    ã     #227
    ä     #228
    å     #229
    æ       #230
    SQL> select regexp_replace('á,â,ã,ä,å,æ','[[=a=]]','a') str from dual;
    STR
    a,a,a,a,a,a

  • Replace of characters with storeb prozedure

    Hi,
    I want to write a stored prozedure that has as source and target a varchars2 field.
    What I want wo do is like the follwing:
    source:a, k, ch, c
    target:d, o, v, ie
    Word example:
    source: jed
    target: and
    The text of the source field has to be analysed and transformed not only letter by letter, because some combinations have two letters like the example with ch.
    Thanks for help,
    Walter

    Hi,
    Why not have a lookup table with source, target and a sequence to know the order to replace. Because of you need to replace ch and c, you need to know the first to be replace, is ch or c ? The result is not the same.
    SQL> select * from replace;
    SO TA        SEQ
    a  d           1
    k  o           2
    ch v 3
    c ie 4
    j  a           5
    e  n           6
    d  d           7
    7 rows selected.
    SQL> create or replace function freplace(wstring varchar2)
      2  return varchar2
      3  as
      4  w_string varchar2(4000):=wstring;
      5  begin
      6  for x in (select * from replace order by seq) loop
      7      w_string := replace(w_string,x.source,x.target);
      8  end loop;
      9  return w_string;
    10  end;
    11  /
    Function created.
    SQL> select freplace('School') School, freplace('jed') jed from dual;
    SCHOOL   JED
    Svool         and
    SQL> truncate table replace;
    Table truncated.
    SQL> insert into replace values ('a','d',1);
    1 row created.
    SQL> insert into replace values ('k','o',2);
    1 row created.
    SQL> insert into replace values ('c','ie',3);
    1 row created.
    SQL> insert into replace values ('ch','v',4);
    1 row created.
    SQL> select * from replace;
    SO TA        SEQ
    a  d           1
    k  o           2
    c ie 3
    ch v 4
    SQL> select freplace('School') from dual;
    FREPLACE('SCHOOL')
    SiehoolNicolas.
    Message was edited by:
    N. Gasparotto

  • Formatting--Replacing 0.00 with SPACES??

    Hi Experts,
    my_Discount LIKE BSEG-KBETR (CURR field i.e. DEC field).
    Am doing grand totals of my_classical report, which contains some amounts and Discount% (but, am not doing Total of Discount%).
    But, am getting 0.00 under the column of Disc% in Grand total row!
    So, I dont wanna even to display the 0.00 numbers, instead I wanna show SPACE, in the said column!
    So, Is it possible?
    thanq.

    KBETR is the currency field,so if no value then it displays   like 0.00
    if you are working on report,when you have output internal table,declare kbetr as char data type.
    move the value from curr value to char data type.
    if kbetr = '0.00'.
    kbeter = space.
    endif.
    You have to declare char data type,you can't pass space to currency data type.
    Thanks
    Seshu

  • Looking for, and replace special characters

    Hi
    I am quite new to AppleScript and can't figure this out. Any help would be appreciated.
    I have received several (a lot of) folders containing images with some strange characters in the file names. The images has to go to web, and I want to replace those characters with some that are web friendly. The characters in question is some Swedish A's and O's (Ä, ä, Ö, ö) and one that looks like the Apple Command symbol. (I was told this one is a combination of a and e).
    Then, I would like to replace all spaces between the words in the file names with an underscore.
    In addition, all image file names start with capitals and I would like to replace these as well.
    Thanks
    Neal
    G5   Mac OS X (10.4.6)  

    Here's a modified version of the standard script:
    try
    tell application "Finder" to set the source_folder to (folder of the front window) as alias
    on error -- no open folder windows
    set the source_folder to path to desktop folder as alias
    end try
    display dialog "Search and replace in:" buttons {"File Names", "Folder Names", "Both"} default button 3
    set the search_parameter to the button returned of the result
    repeat
    display dialog "Enter text to find in the item names:" default answer "" buttons {"Cancel", "OK"} default button 2
    set the search_string to the text returned of the result
    if the search_string is not "" then exit repeat
    end repeat
    repeat
    display dialog "Enter replacement text:" default answer "" buttons {"Cancel", "OK"} default button 2
    set the replacement_string to the text returned of the result
    if the replacement_string contains ":" then
    beep
    display dialog "A file or folder name cannot contain a colon (:)." buttons {"Cancel", "OK"} default button 2
    else if the replacement_string contains "/" then
    beep
    display dialog "A file or folder name cannot contain a forward slash (/)." buttons {"Cancel", "OK"} default button 2
    else
    exit repeat
    end if
    end repeat
    display dialog "Replace “" & the search_string & "” with “" & the replacement_string & "” in every item name?" buttons {"Cancel", "OK"} default button 2
    tell application "Finder"
    set the item_list to every item of entire contents of source_folder
    tell me
    set item_list to reverse of the item_list
    end tell
    set source_folder to source_folder as string
    repeat with i from 1 to number of items in the item_list
    set the_name to name of item i of the item_list
    set this_item to item i of the item_list
    set this_info to properties of this_item
    set the current_name to the_name
    set change_flag to false
    repeat with this_char from 1 to (count items of search_string)
    if the current_name contains item this_char of (search_string) then
    if the search_parameter is "Folder Names" and ¬
    folder of this_info is true then
    set the change_flag to true
    else if the search_parameter is "File Names" and ¬
    folder of this_info is false then
    set the change_flag to true
    else if the search_parameter is "Both" then
    set the change_flag to true
    end if
    if the change_flag is true then
    set this_item to item i of the item_list
    -- replace target string using delimiters
    set AppleScript's text item delimiters to the item this_char of search_string
    set the textitemlist to every text item of the current_name
    set AppleScript's text item delimiters to the item this_char of replacement_string
    set the newitemname to the textitemlist as string
    set AppleScript's text item delimiters to ""
    set the current_name to newitemname
    end if
    end if
    end repeat
    my setitem_name(thisitem, current_name)
    end repeat
    end tell
    beep 2
    on setitem_name(thisitem, newitemname)
    tell application "Finder"
    --activate
    set the parentcontainerpath to (get the container of this_item) as text
    if not (exists item (the parentcontainerpath & newitemname)) then
    try
    set the name of this_item to newitemname
    return this_item
    on error the error_message number the error_number
    if the error_number is -59 then
    set the error_message to "This name contains improper characters, such as a colon (:)."
    else --the suggested name is too long
    set the error_message to error_message -- "The name is more than 31 characters long."
    end if
    --beep
    tell me to display dialog the error_message default answer newitemname buttons {"Cancel", "Skip", "OK"} default button 3
    copy the result as list to {newitemname, button_pressed}
    if the button_pressed is "Skip" then return 0
    my setitem_name(thisitem, newitemname)
    end try
    else --the name already exists
    --beep
    tell me to display dialog "This name is already taken, please rename." default answer newitemname buttons {"Cancel", "Skip", "OK"} default button 3
    copy the result as list to {newitemname, button_pressed}
    if the button_pressed is "Skip" then return 0
    my setitem_name(thisitem, newitemname)
    end if
    end tell
    end setitemname
    This script variant works by accepting a source string in the form "AB" and desired string "CD". When run, ABCA will become CDCC with the sample strings.
    (19254)

  • Replace encoded characters in URL

    Hi gurus,
    I have the following requirement and I don't know how to solve it in the best way.
    I have a Z transaction for uploading a local file. This file contains URL's and after upload, there are stored in SAP.
    I need to check this URL and replace encoded characters with corresponding codes, for example: space -> %20
    How can I do this? I've been looking for a solution, but I haven't found anything usefull yet.
    Any ideas?
    Thanks a lot!

    Have a look at class CL_HTTP_UTILITY. There are some methods which looks promising.
    The method ESCAPE_URL is waht you needed.
    pass UNESCAPED = 'http://forums.sdn.sap.com/edit!default.jspa?messageID=11060123'
    output = HTTP%3a%2f%2fFORUMS%2eSDN%2eSAP%2eCOM%2fEDIT%21DEFAULT%2eJSPA%3fMESSAGEID%3d11060123
    & for vice versa use UNESCAPE_URL
    Edited by: Keshav.T on Feb 7, 2012 2:23 PM

  • Suppress Underscore and replace with Space in FR

    Hi
    Hyperion Financial Reporting 11.1.2.1
    In the excel, with a Essbase add-in, we have an option as Suppress--->Underscore Characters
    This will eliminate the Underscore and replaces with a space
    I want to know if the same functionality exists in the FR Studio
    Any insight would be much appreciated
    Regards
    Tejo jagadeesh

    Sorry, I misread your question. I thought it would be doable though Conditional Format: http://docs.oracle.com/cd/E17236_01/epm.1112/fr_user/ch10s02.html
    Something like this:
    If Member Name > Dimension > contains > _ > Format Cells > Replace >
    But then it replaces the whole member with space which I believe is not something you are looking for.
    One other option is to have another alias table in your database and select the new alias table in FR. I know this is an option for Essbase. I am not so sure about other db connections.
    Cheers,
    Mehmet

  • Find and Replace with space or tab

    Hi,
    I have a text file that has commas separating values. I saved it as a csv, but am not getting the results I need with the csv file. I'd like to replace the commas with a space or a tab.
    I know how to use find replace, but I do not know how to indicate these non-printing characters. I tried the ascii code &#32 for space, but i simply get that string of characters replacing my commas.
    ANy help?
    Thanks

    KW,
    You didn't say what program you were using for the Find and Replace, but I'd suggest that Pages would be your best bet. Spaces can be typed-in directly, and several other non-printing characters can be inserted from a drop-down menu.
    The Insert drop-down seems to be available only in Pages, as opposed to Numbers and TextEdit.
    Jerry

  • DUMP: replace all occurrences of space in string1 with string2.

    Why does this statement results in a dump:
    replace all occurrences of space in string1 with string2.
    same with
    replace all occurrences of ' ' in string1 with string2.
    string2 is a string without spaces!
    Is there any drawback on using this statements as a workaround?
    while sy-subrc eq 0.
      replace space with string2 into string1.
    endwhile.
    Thanks
    norbert

    Hi,
    See this example i got from ABAPDOCU
    replacing values
    DATA: t4(10) TYPE c VALUE 'abcdefghij',
          string4 LIKE t4,
          str41(4) TYPE c VALUE 'cdef',
          str42(4) TYPE c VALUE 'klmn',
          str43(2) TYPE c VALUE 'kl',
          str44(6) TYPE c VALUE 'klmnop',
          len4 TYPE i VALUE 2.
    string4 = t4.
    WRITE string4.
    REPLACE str41 WITH str42 INTO string4.
    WRITE / string4.
    string4 = t4.
    REPLACE str41 WITH str42 INTO string4 LENGTH len4.
    WRITE / string4.
    string4 = t4.
    REPLACE str41 WITH str43 INTO string4.
    WRITE / string4.
    string4 = t4.
    REPLACE str41 WITH str44 INTO string4.
    WRITE / string4.
    SKIP.
    ULINE.
    Example for condensing strings
    DATA: string9(25) TYPE c VALUE ' one  two   three    four',
          len9 TYPE i.
    len9 = strlen( string9 ).
    WRITE: string9, '!'.
    WRITE: / 'Length: ', len9.
    CONDENSE string9.
    len9 = strlen( string9 ).
    WRITE: string9, '!'.
    WRITE: / 'Length: ', len9.
    CONDENSE string9 NO-GAPS.
    len9 = strlen( string9 ).
    WRITE: string9, '!'.
    WRITE: / 'Length: ', len9.
    SKIP.
    ULINE.
    Thanks & Regards,
    Judith.

  • Preventing Discoverer Admin replacing underscores with spaces on refresh

    Hello,
    On refreshing a Business Area, Discoverer Administrator will automatically replace underscores with spaces for any new items/folders to be incorporated. I would prefer this not to happen i.e. the names should retain the underscores. I haven't found any way to do this from within Discoverer Admin - are there some registry settings that I can tweak or is it just not possible,
    Thanks in anticipation,
    Kevin.

    Hi,
    Well, you could try using a eul_trigger$refresh_new_column trigger. I must admit I have never tried this, but the details are in the documentation (http://download.oracle.com/docs/html/B13916_04/appendix_b.htm#sthref2417).
    Rod West

  • Replacing windows new line characters with JAVA

    I am importing a file into the database... the file is written by a client using windows, and it is a text file.
    When there is a windows new line character at the end of the line (^M), it is getting saved to the database as part of the string value.
    When we parse this data to run a report, the (^M) are being written back out to the file and causing the fields and data not to line up.
    We want to REPLACE the ^M with some other character (whatever it doesn't matter)... how can java do that???
    We tried replacing '/n' with '###' and it will show the ###, but the line still breaks.
    TIA,
    Tonya

    The characters in question are cr = \r = ascii(13) and lf = \n = ascii(10). Windows uses CrLf, Unix uses Lf and some systems use just Cr. You can use the String.replaceAll or the pattern matching classes to fix this up, see java.util.regex.Pattern, and java.util.regex.Matcher.

Maybe you are looking for

  • Itunes will not install on windows 7, gives me installer error

    It says problem with windows installer package and a problem with a program required for the installer. HELP

  • Creating a pdf file larger than 11 x 8.5 online

    I'm trying to convert a Microsoft Publisher file that's 17"h x 11"w to a pdf file using the online converter.  In my first attempt, it split the document to fit onto 4 separate 11x8.5 pages.  How can I convert the file from .pub to .pdf on a single p

  • Validate Activity Doesn't work for String type Element

    Hi Experts, I am using Validate Activity in my project to validate the variable against the Schema In my XSD I have element with below definition: *<xsd:element name="XXXXX" type="xsd:string" minOccurs="1" nillable="false"/>* When I pass NULL value t

  • Display Changes: Change document

    Hi all, I have a ALE link established between two partner SAP systems. When I change some field in the e.g. material master, it triggers an IDoc to the partner system and updates the same. In the source system the Changes are displayed in the Change

  • Rename a column in query

    Hello, I want to rename a column in a query. What are the possible method? 1. We use "AS" to rename. E.g. SQL> select sysdate as "Today's date" from dual; Today's d 12-JUN-07 The above query returns "Today's Date". But the column name in the result s