Removal of invalid spaces from a string

Hi all

I have a pl/sql string that has "new line", "Form Feed", "Carriage return", "space, Horizontal / vertical Tab" and many white space characters.

For example:

Variable1 varchar2 (3000);


Variable1 = ' Hello World Hello World
Hello everybody, Hello World Hello World
Hello everyone"

I need a motion to remove all spaces (specifically, it must remove \f,\t,\n,\v,\r) and the string must sees itself as below

1 = var "" Hello World Hello World Hello World Hello World Hello World Hello everyone " "

Help, please. Thanks in advance.

\s will do the same thing as [: space:] and includes [\t\r\n\v\f]

You can add [: cntrl:] to include any other potential garbage

SELECT

REGEXP_REPLACE)

"Hello World Hello World

Hello everybody, Hello World Hello World

Hello World ",

"[[: cntrl:] [: space:]] + ',' ') r"

OF THE DOUBLE

R

' Hello World Hello World Hello World Hello World Hello World Hello world.

Tags: Database

Similar Questions

  • Removing spaces from a string

    I have a string where there is a particular sequence, I want to replace.

    The sequence is ' / p e r.

    I tried replaceAll ("-p e r," ""); Tried to replace the charsequence, but doesn't have too much work.

    I am able to replace / by replaceAll("\\\","")

    Somehow if I put string a = "/ p e r ' and

    a.Replace ("" p e r ", pr) then came out / pr.

    But I read this to a BLOB field and there spaces between the two string operations fail somehow.

    Can someone help me on this please. I'm stuck for some time

    Please also let me know if this isn't the right group, because I don't have an answer during my last post here

    See Delete white spaces from strings in Java - Stack Overflow

  • Remove the spaces from the string

    Hello
    Does anyone have a simple routine/function to remove all but 1 space between "words" (row charactives no spaces).

    For example, I would convert the string (I used '.' as a 'space'):

    'This... too... a lot of people of spaces' to
    'This.has.too.many.spaces '.

    I need this to compare strings of registration where a user can hit the space bar one extra time or 2.

    Thanks in advance.

    hefterr wrote:
    > Thank you Dan. This seems good.
    > Can I use...
    > Is not sure the quotes for 2
    > spaces

    You need quotes replacement in case of nesting them like this... Make your choice.


    OR

  • How can we remove the present space in the string in BlackBerry?

    Hello

    Suppose I have string like "New York". How can I remove the space between and do like "New York". As BlackBerry does not support the Java replaceAll() method, I am not able to do.

    Thank you...

    StringUtilities.removeChars (...)

  • delete a random amount of extra spaces from string

    Hello I'm a string input that sperates a table of data with an amount random spaces.

    Is it possible to replace all the sequences of space by space?

    for example

    CPU PID MEM

    15.689 12.2 6610

    21.8. 156-6611

    (if the spaces are random)

    I have ried replaces the double spaces with single spaces a total of 8 times in the list, but for some reason which is also (somewhat) deleting simple spaes as well and im not sure why.

    You can do this with a single search and replace String.  You must enable regular Expressions for this function (with the right button of the function, choose Regular Expression).  The regular Expression '+' (space followed by a sign +) will match one or more spaces - son from that in the search string.  Son of a single "" ((espace) space) in the replacement string, true Set "replace all", then run the function and it will replace all multiple spaces (from the current line) by a space.  If you want to manage several lines in the string, enable this option as well.

    Bob Schor

  • Remove the unused characters from string

    Hi, I try to remove unused characters from a string, but I can't find a function for this.

    The string like: 0000 0000 0000 0000 0000 0000 0130 3130 3030 3030 3004 0000 0000 0000 0000 0000 0000 0000, I need the characters from 01 to 04.

    I need some advice.

    If the characters between the SOH and EOT had a NULL value, then Match Regular Expression can be a choice:

    Find \x01, find something else THAN \x04, then find \x04

  • remove the odd spaces of the hexadecimal string

    Hello

    I would like to remove the odd spaces to a hexadecimal string, and the output result.  That's what the input string will look like:

    01 00 04 0F FF 36 3B CC...

    I want the output to be:

    0100 040F FF36 3BCC...

    I got the attached forum labview code earlier, but it does not work with the text.

    Any help is greately appreciated.

    Thank you

    hiNi.

    Try this version 8.2.

  • How to remove tabs, several spaces, quotes from data in the column.

    Hello

    How can we remove legs, several spaces, quotes from data in the column.

    Entry:

    H ope you 'are' Ingo w ell

    Output:

    H ope do you everything - there is a tab in hope and double-spaced in the well. This should be replaced by space. (Tab and multi spaces)

    I found myself with below:

    REGEXP_REPLACE (REGEXP_REPLACE (Replace (col, Chr (9),' '), ' () {2,} ', ' '),'[' ""]', ")

    Can we do more efficiently, your contributions are appreciated.

    I tried

    REGEXP_REPLACE (col,'[^ [a - z, A - Z, 0-9, Chr (0) - Chr (127) [: Space:]]] *', ") but the tabs still exist and that my data have German characters I can't go along with this.

    Thank you

    GVK.

    Hello

    Karthik417 wrote:

    Hello

    Thanks for your suggestion. In the above expression, we still missed to replace the double quotes.

    So thought we must use another regular expression instead of REPLACE.

    Select REGEXP_REPLACE (REGEXP_REPLACE (' H ope you "are" d "Ingo ell w ',' [' |])) CHR (9) | + ',' '),'["" "]') twice;

    I suppose we must use at least 2 REGEXP to achieve and cannot get it with a single expression.

    Thank you

    Sorry, I removed single quotes, not double - quote.  (This shows one of the reasons why having a few lines of sample data is very useful).

    I think you don't need 2 separate functions.  I do not think that the two must be REGEXP_REPLACE; You can use TRANSLATE to remove both types of quotation marks in a single function call:

    TRANSLATE (REGEXP_REPLACE (col

    , '[ ' || CHR (9) | ']+'

    , ' '

    )

    , '?'''"',

    , '?'

    )

    Of course, you can use use REGEXP_REPLACE to remove the quotes, if you really want to.

    Powerful they are, regular expressions are basically only 1 thing, things not 2 or more different.  Sometimes, he can watch as they do several things, because they can operate on character classes, like the series containing the and the and a variable number of characters.  For example, the REGEXP_REPLACE function, I used above is simply changing expression expression x y, where x is 1 consecutive or more characters of a given set.  As we both demonstrated, we can have a separate function that changes from p to q, but I know not all built-in function which, in general, can change x to y at the time that it changes from p to q.  TRANSLATE comes close, but TRANSLATE only works if x, y, p and q are single (or NULL), characters not expressions.

  • Question: Remove spaces from |

    I have a table that has a column named NAME and under it contrain a list of names.
    NAME
    Ann Pert
    Steven Pappas
    Mai Xiong
    I'm trying to join this table to the other which contrain one list of names as well, but they are in the format of the first NAME and last NAME in separate columns
    FIRST NAME     LAST NAME
    ANN               PERT
    STEVEN              PAPPAS
    I'm trying to do something like:

    Select *.
    TABLE_NAME FROM HAS, TABLE_NAME B
    WHERE B.SID = B.FIRST_NAME | B.LAST NAME

    But because there is a space between the first and the last name in the table A is not picking up. So is there a way to remove spaces from | or another method

    (I have not uplad a DataSet because it's just an issue that seems easy to answer)
    Using oracle 10

    Why not just concatenate fisrt name + space + family name:

    Select *
    FROM TABLE_NAME A, TABLE_NAME B
    WHERE A.NAME = B.FIRST_NAME || ' ' || B.LAST NAME
    /
    

    SY.

  • Cannot connect iPhone 7 more to iTunes because an invalid response from the device

    I tried to sync my phone to iTunes and I get an error message stating "invalid response from the device. I tried to remove the password, and it still doesn't work. I also tried using a new USB cord. I'm doing something wrong? I can't sync my music or ringtones. Will there be an update to iOS 10 soon to solve this problem? I am extremely disappointed that I can not connect my new phone!

    You use iTunes version 12.5?

    Get the latest version of iTunes - Apple Support

  • How can I remove the double song from my iPhone titles?

    How can I remove the double song from my iPhone titles?

    Hello josephever,

    Thank you for using communities of Apple Support.

    To remove the music from your iPhone, you will need to follow the steps below:

    Remove music

    Remove tracks, albums or playlists in the music app delete all music in the settings.

    Remove the application, music, playlists, albums or songs

    1. Find the song, album, or playlist you want to delete.
    2. Tap the Options icon plus on the right side of the screen.
    3. Press DELETE.
    4. When you are prompted, press Delete [purchased or Playlist] to confirm.

    Delete all the music on your device

    1. Go to settings > general > storage and use iCloud > storage management.
    2. Tap music.
    3. Under the music, by sweeping left on all the songs.
    4. Press DELETE.

    If you delete a purchase that you have not saved on your device, the purchase will also hide your purchase history.

    If you are a member of music from Apple or iTunes subscription game, you might see 'Remove my music' instead of delete. Remove the music from your iPhone, iPad or iPod touch also removes it from your music library to iCloud. If you delete music on a single device, it also deletes other devices. Learn how delete your music to iCloud library media.

    On an iPhone, iPad or iPod touch, if you do not have the music available offline, it is cached by using the available space on the device. The device will delete cache and caching of music, as space is needed by the device.

    Remove music, movies, applications and other content to your iPhone, iPad or iPod touch

    See you soon.

  • cut out the spaces from excel

    How to cut spaces from an Excel file? I would like to remove the spaces to the left of cell B2 to B & myData (myData is 12 857). I can't find the TRIM command in applescript Excel manual or the dictionary of Microsoft Excel.

    Trim() is an Excel function, then you might do this in Excel by creating a new column filled with TRIM() functions.

    If you want a solution based on AppleScript, that would involve using the AppleScript routines for handling text...

    In my humble OPINION, the path of Excel is more likely, especially if you are not familiar with AppleScript, but poster if you cannot work/find a way to do in AppleScript.

  • Remove the column space

    Hi, just wanted to help regarding the deletion of my user name column spaces. I used the following code to remove the double space to a single space.
    regexp_replace(table_a.username, ' {2,}', ' ')
    but when you look through my answers I noticed that there is an extra in a few names at the end of the field as well. The original double space was between first name and family name, but now I have to replace the space completely, but don't know how.

    If someone could please advise.

    Thanks in advance.
    with t as (
               select 'ABC         DEF   ' str from dual
              )
    select  regexp_replace(str,' *( |$)','\1')
      from  t
    /
    
    REGEXP_
    -------
    ABC DEF
    
    SQL> 
    

    SY.
    P.S. It does not remove the spaces to the left, just backwards.

    SY.

  • Remove the extra space of a long document

    Hello

    I've seen a number of find/replace and GREP formulas to do similar things. I have NO scripting language or coding experience and have worked to understand GREP.

    So I'm a little afraid to use it because I don't know what all the modifiers call (I have a few neat GREP cheatsheets print as Mike Witherell I can absorb up to get a good reference)

    I need something I can copy and paste into find/replace or dialog GREP that will do the following in less than 12 steps (we hope) without doing something as catastrophic as the removal of all my paragraph marks (which I almost did with someones GREP expression)

    1. No space before a comma, period, exclamation point, question mark, colon, semicolon
    2. A space only after any of these
    3. A space before an opening parenthesis and a space after the closing parenthesis
    4. No space before the closing parenthesis or after the opening parenthesis
    5. Remove double or extra spaces (en, em, etc.)
    6. Remove comma before parentheses
    7. Remove all white space after a paragraph mark

    I think that's it

    I found this one recently (perhaps Jongware?)

    [~ m ~ > ~ f ~ | ~ S ~ s < ~/~,~3~4%] {2.

    From my limited understanding addresses em, in, flush and hair, space nonbreaking, space figure, third space - not sure of the rest. It's really way over my head.

    I know it will be a piece of cake for you guys

    Thank you

    I was hoping Jongware would come in with something really elegant (and maybe he'll still) but in the meantime, my approach would be to start by eliminating all multiple spaces except paragraph returns and forced line breaks. This appears to do:

    Find (\s)(\p{space_separator}|\t) + and replace it with $1

    This leaves the first space and will remove the following spaces to a line or a paragraph break (and not completely tested, but I guess that other kinds of breaks) is encountered, leaving the jump line or paragraph intact.  Note that this will destroy the tables built with tabs (as opposed to the 'real' tables) with several tabs between the items, and it does not alter a single space before a line or paragraph break.

    Then I would remove the whitesapce at the ends of paragraphs, etc.:

    Find (\s)(\n|\r) and repace with $2 seems to do, and it also seems to leave several returns (I don't know if you want to delete these) and work with the other breaks as well (again, not fully tested). The \s$ and replace it with nothing more simple, removes the first return to a sequence of two-back and seems to ignore e other types of breaks completely.

    At this stage avoid any several spaces other than possibly empty paragraphs. If you want to get rid of these, you can run find/replace list script by the integrated switchis refers to the single request of return in the dropdown, find/replace.

    So now you find the opening of single and double parentheses, square brackets or braces quotes and remove space after them, if it exists:

    Find ([\[\{\(~{~[])(\s) and replace it with $1

    and finally to remove any white space before your selected punctuation and the closure of the above case:

    Find (\s)([.,;:!\)\]\}~}~]]) and replace it with $2

    The last two queries will probably also work with look-bhind for the first and to come to the second (putting classes in the expressions of the eyes) and repalcing with nothing, but I don't know which method is the most effective. The last request might also be missing a space and an apostrophe or mistakenly remove a space before a work that begins with an apostophe (again, not tested). and is ignoring straigh citations of any type, because they are ambdextrous and may want to space on each side.

    I hope that the forum does not spoil one of these phrases...

  • Substitute the inconsistent spacing with a single space in a string

    is it possible to replace multiple spaces in a string with a space only. Number of places is different all the time.

    say a field contains strings with spaces
    I need to replace all those values so that there will be only one space between words.

    For example.
    Input                             Expected Result
    aaa    bbb                       aaa bbb
    ww                vv             ww vv
    ww ss      kk                    ww ss kk
    
    [/code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

    user11253970 wrote:
    I'm in Oracle 9i :( I can't use reg exp

    Assuming that the strings contain no CHR (0) (character with ascii code 0):

    SQL> SELECT  'aaa          bbb  aaa bbb' str,
      2          replace(replace(replace('aaa          bbb  aaa bbb',' ',' ' || CHR(0)),CHR(0) || ' '),CHR(0)) new_str
      3    FROM  dual
      4  /
    
    STR                                 NEW_STR
    ----------------------------------- -----------------------------------
    aaa          bbb  aaa bbb           aaa bbb aaa bbb
    
    SQL> 
    

    SY.

Maybe you are looking for

  • My iPod Classic is not synchronized

    My iPod Classic will not sync with my shiny new iMac, why? My Shuffle, it's what's happening? Why should it be so difficult? I allowed off my old iMac for iTunes.

  • HP V042TX lost the connection to the WIFI

    Hi, I just bought HP Pavilion 14 V042TX and my wifi connection is less signal, and sometimes it will be the interruption of the connection to wifi. my router is the Broadcom 802.11n network adapter and my OS is Windows 7 Home Basic 64bit.so what I wo

  • Encryption Issos Moto G 2nd generation

    I just got the Moto 2 G to be used with my messaging business, but for that I need it to be encrypted according to the rules of enterprise security. While I finish the encryption process and it ends as the guest screen PIN pass and after inserting an

  • Acquire the values only when the digital output is high.

    Hello I work with test of transistor, whose door is controlled by the digital release of USB6289, related to BNC2120. Test plan: Door 1.transistor is enabled for 5seconds, with P0.0 for example 2. then, everything remains off for 1secondes. 3.p0.1 is

  • 'Microsoft' phone calls

    No Microsoft or other microsoft representative (would) phone consumers in order to remove the problems of computers to consumers?