How do I use an ORACLE REGEX function to remove all leading and trailing line break characters and spaces?

Chad

How do I use an ORACLE REGEX function to remove all leading and trailing line break characters and spaces?

For example, assume I have the following string where refers to actual invisible carriage return line feed characters. Here's the input:

"     
   
   
   SELECT * 
   FROM
   TABLE
              
             "

And here's the desire output:

"SELECT *
   FROM 
   TABLE"
MonkeyZeus

This would do it if regex_replace() is a requirement:

select regexp_replace('     
   
   
   SELECT * 
   FROM
   TABLE
              
             ', '^\s*|\s*$', '') as hello
from dual

See https://www.techonthenet.com/oracle/functions/regexp_replace.php for documentation.

enter image description here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Regex remove all leading and trailing special characters?

How to use "regsub" or "regex" in Tcl to remove leading and trailing characters from a "start" period

remove all leading and trailing and blank spaces

Remove leading and trailing spaces?

How can I remove leading and trailing non-alphanumeric characters

How to remove leading zeroes & trailing spaces in COBOL

How to remove leading and trailing spaces in Powershell?

Regex that will match 6 characters that only allows digits, leading, and trailing spaces

How can I remove ONLY leading and trailing spaces while leaving spaces in between words alone with an excel formula?

Java Regex, remove leading spaces of each line

How to remove only trailing spaces of a string in Java and keep leading spaces?

JavaScript remove leading and trailing spaces

How do you remove trailing spaces in all files except Markdown?

How do I use Regex in python to remove ALL characters EXCEPT letters

How should I remove all the leading spaces from a string? - swift

How to remove leading and trailing " , remove leading and trailing spaces from each row each field in ksh

In Window Batch - how do I remove leading spaces from a file?

How do I remove all trailing characters from a dataframe that are equal to a letter 'h'

Javascript remove all leading and trailing junk characters in a string

Remove trailing spaces and add them as leading spaces

How to remove leading/trailing white spaces in C without memory leak

Ant - How to remove the leading or trailing spaces from the values in the properties file?

Use regex pattern matching to remove the two leading and trailing lines

How to restrict use of Leading and Trailing spaces in the textbox using jquery?

How to remove specific leading and trailing characters from Euro (€) expression?

remove leading and trailing break tags from string

XSLT remove leading characters, underscore and trailing characters

Remove leading or trailing spaces in an entire column of data

BASH remove leading and trailing spaces in array