Remove Span tag with text from String
May be this will help you:
String yourString = "<span class=\"exam-dates-title\">Exam</span>Welcome";
int index = yourString.lastIndexOf(">");
String result = yourString.substring(index + 1, yourString.length());
how to remove span tag from the string?
For your edited question you can do this:
var str = // your string here
str = str.replace(/<\/?span[^>]*>/g,"");
Demo: http://jsfiddle.net/vXXJ6/
PHP Regex Pattern, removing span tags and inner text from string
This should be it.. The [*] matches the * character while the .*> matches any up till the > character
if (substr_count($value, '*<span') > 0) {
$value = preg_replace('/[*].*>/', '', $value);
}
Regex to remove span tags using php
You can remove all tag using preg_replace('/<[^>]*>/', '', $content);
And also you can remove only span tag preg_replace('/<span[^>]+\>/i', '', $content);
using this:
<?php
$content = '<div><span class="smw smw-inline smw-basic smw-ct-default smw-visible" data-symbol="GSD.V" data-type="inline" data-refresh-frequency="5" data-source="live">
<span class="smw-market-data-field smw-field-l1" data-field="l1">0.65</span>
</span></div>';
echo $string = preg_replace('/<[^>]*>/', '', $content);
echo $new_string = preg_replace('/<span[^>]+\>/i', '', $content);
?>
How can I remove HTML tags other than div and span from a string in JavaScript?
To remove all tags excluding specific tags, you can use the following regular expression.
const str = "<div><p></p><span></span></div>";
console.log(str.replace(/(<\/?(?:span|div)[^>]*>)|<[^>]+>/ig, '$1'));
Remove span tag from element html dom parser
May be you can replace that span tag with blank:
echo $info['diesel']=str_replace("<span>zł</span>","",$info['diesel']);
Related Topics
Android: Open a Pdf from My App Using the Built in Pdf Viewer
Android Studio - How to Find Valid Certification Path to Requested Target
Unable to Add Window - Token Null Is Not Valid; Is Your Activity Running
Android: How to Scale a Bitmap to Fit the Screen Size Using Canvas/Draw Bitmap
Showing Thumbnail for Link in Whatsapp || Og:Image Meta-Tag Doesn't Work
How to Set the Image from Drawable Dynamically in Android
Getting the Current Fragment Instance in the Viewpager
Rendering HTML in a Webview With Custom Css
Android Prevent Immediate Trigger of Alarm Service If Alarm Time Has Passed For the Day
How to Execute Code When Application Is Closing
Force Override Camera Image on Android
Recyclerview Slow Scrolling Performance and Lag/Halt Sometime While Scrolling
Clear Cache in Android Application Programmatically
How to Give Pause or Gap Between Words in Tts in Android
How to Automatically Open App When Receive Push Notification