I'm not good at all in regex and I'm looking for an expression to get everything between and including either:
<script*/> OR
<script*</script> //asterisk refers to everything between
Basically, I want to copy sections from a single element for print but delete all tags and everything in between
A single statement that covers both scenarios would be preferable, but two solutions will work just fine
Any help will be greatly appreciated
This should work for both cases:
<script.*((/>)|(</script>))
Related
Problem: Hi, this ‡ character is getting rendered correctly on my webapp.
I have tried using html entity as well but still its showing as ‡ Or ‡.
The caracter ‡ or maybe similar to not equal to (≠) , was a scpecial character.
And need another syntax, to be shown like that.
I can recommend you to use this line of code
<span style='font-size:100px;'>≠</span>
For more details, we can read this link of reference .
Hope it was helpful.
Thank you
we use the autocomplete component from RichWidgets and we get extra back-slash in the javascript which causes a bug in the autocomplete.
autocomplete JavaScript code tries to split the bulk of rows into items in the autocomplete list but the extra back-slash interrupt the split (js method from functioning well.
although we use the same component in another module (where it works perfectly without the extra back-slash) referencing to same RichWidgets but we still
update:
this is only when we use Arabic language, it works fine in english.
Without more context, it's difficult to answer, but if it only happens with the AR locale then it might be the case that there are translations defined for those strings that are causing the issue.
Check if setting the behavior of those strings to not translate makes any difference.
Consider the following code:
document.write("a<b");
When I try to run that, it makes a outputs displaying the letter a. I think this is because it thinks that I want to start a tag, therefor excluding the rest. Is there a way to bypass this? A way to still display the <, and the rest of the line, too? It seems that the escape character, \, does not work (or am I doing something wrong?)
Thanks
Yes it does think you are writing a tag for document.write(), instead use <, as in less-than:
document.write("a<b");
I have an MVC-project where I store data in a database and one of my views contains textboxes to edit this data.
Because of the specifics I can't create the textboxes directly via TextBoxFor(), EditorFor() etc. but have to affect the value with JavaScript, so what i do is write the needed value in the javascript code at page loading, and this code is later on triggered to affect the textbox value.
$("#textboxID").val("#HTML.Raw(Model.value)");
This workes fine until one of strings has got quotes in it.
When i input it directly like
$("#textboxID").val("#Model.value");
it will be HTML-encoded with the quotes written as > & quot; (without space of cource)
What i found out is that the only way to output quotes correctly is by escaping them with backslash \ however i can't seem to find a helper to do that.
Is there a solution? Am i doing anything wrong?
For now, i found a workaround inspired by Filipe Borges suggestion
#Html.Raw(Html.Encode(Model.Libelle).Replace(""", "\\\""))
It's very ugly, but at least it solves the problem, I appreciate anyone suggesting a better solution.
For now, i found a workaround inspired by Filipe Borges suggestion
#Html.Raw(Html.Encode(Model.Libelle).Replace(""", "\\\""))
It's very ugly, but at least it solves the problem, I appreciate anyone suggesting a better solution.
Solved using:
#Html.Raw(Html.Encode(Model.value).Replace(""", "\\\""))
First suggested replacing " by \" using #Model.value.replace(""", "\\\""), but it does not work because the value only contains " after the default html encoding is applied by mvc.
Edit: Final solution by Souhaieb Besbes. Edited mine to not keep it wrong.
You can use single quote to show double quotes as following:
$("#textboxID").val('"'+#Model.value+'"');
I'm aware of what WYMEditor is all about and that using Paragraphs for spacing is not intended, however the problem here is with the client requiring that we give them this functionality.
I've looked high and low to find where WYMEditor does it's stripping of whitespace and can't seem to find it at all.
It seems that when you press enter it creates a P visually, however when clicking the source it doesn't contain it. Furthermore, manually editing HTML source to contain <p> </p> doesn't work, as WYMEditor strips it out.
Just wondering if anybody has had this issue before and knows how to get rid of this functionality? It's worth noting that I believe the replacement is happening both in the 'text' module of Django-CMS, and also in the Javascript for WYMEditor.
Turns out, the function that does this stripping is very simply named, for some reason I missed it in (multiple!) searches for the word 'empty' in the script file.
It's located in jquery.wymeditor.js, line ~3440 there is the function WYMeditor.XhtmlSaxListener.prototype.removeEmptyTags, simply stop the replacement:
WYMeditor.XhtmlSaxListener.prototype.removeEmptyTags = function(xhtml)
{
return xhtml;// .replace(new RegExp('<('+this.block_tags.join("|").replace(/\|td/,'').replace(/\|th/, '')+')>(<br \/>| | |\\s)*<\/\\1>' ,'g'),'');
};
That obviously stops the stripping of whitespace!