Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
7b5ec8d8
Commit
7b5ec8d8
authored
Sep 26, 2019
by
Carsten Rose
Browse files
Add MySQl strip_tags() function
parent
1221dca8
Pipeline
#2423
passed with stages
in 3 minutes and 8 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Documentation/Manual.rst
View file @
7b5ec8d8
...
@@ -6860,6 +6860,21 @@ Output::
...
@@ -6860,6 +6860,21 @@ Output::
hello world-
hello world-
.. _strip_tags:
strip_tags: strip html tags
^^^^^^^^^^^^^^^^^^^^^^^^^^^
The SQL function strip_tags(input) returns 'input' without any HTML tags.
Example::
10.sql = SELECT strip_tags('
<a
href=
"https://example.com"
><b>
my name
</b>
<i>
is john
</i></a>
- end of sentence')
Output::
my name is john - end of sentence
.. _download:
.. _download:
Download
Download
...
...
extension/Classes/Sql/function.sql
View file @
7b5ec8d8
...
@@ -83,3 +83,23 @@ BEGIN
...
@@ -83,3 +83,23 @@ BEGIN
SET
output
=
IF
(
input
=
''
,
token
,
input
);
SET
output
=
IF
(
input
=
''
,
token
,
input
);
RETURN
output
;
RETURN
output
;
END
;
END
;
###
#
#
strip_tags
(
input
)
-
copied
from
https
:
//
stackoverflow
.
com
/
questions
/
2627940
/
remove
-
html
-
tags
-
from
-
record
#
DROP
FUNCTION
IF
EXISTS
strip_tags
;
CREATE
FUNCTION
`strip_tags`
(
str
TEXT
)
RETURNS
TEXT
DETERMINISTIC
SQL
SECURITY
INVOKER
BEGIN
DECLARE
start
,
end
INT
DEFAULT
1
;
LOOP
SET
start
=
LOCATE
(
"<"
,
str
,
start
);
IF
(
!
start
)
THEN
RETURN
str
;
END
IF
;
SET
end
=
LOCATE
(
">"
,
str
,
start
);
IF
(
!
end
)
THEN
SET
end
=
start
;
END
IF
;
SET
str
=
INSERT
(
str
,
start
,
end
-
start
+
1
,
""
);
END
LOOP
;
END
;
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment