Is there the regular expression that can completely remove a HTML tag?  By the way, I'm using Java.
16095
Is there a good way to remove HTML from a Java string? A simple regex like replaceAll(&quot;\\&lt;.*?&gt;&quot;, &quot;&quot;)   will work, but things like &amp;amp; wont be converted correctly and non-HTML between the two angle brackets will be removed (i.e. the .*? in the regex will disappear).
93119
I am trying to delete certain text that appears before / on every line.   I have something like:  testing.db.com/7fad416d-f2b3-4259-b98d-2449957a3123 testing.db.com/8a8589bf-49e3-4cd7-af15-6753067355c6   and I just want to end up with:   7fad416d-f2b3-4259-b98d-2449957a3123 8a8589bf-49e3-4cd7-af15-6753067355c6    Can anyone help me with a regular expression? Everything I have found is deleting after /, not before.
2766
Is there a case insensitive version of the  jQuery selector or should I do the work manually by looping over all elements and comparing their .text() to my string?
58463
Does anyone know of an easy way to escape HTML from strings in ?  I need to be able to pass an arbitrary string and have it properly escaped for display in an HTML page (preventing JavaScript/HTML injection attacks).  I'm sure it's possible to extend jQuery to do this, but I don't know enough about the framework at the moment to accomplish this.
94209
I have a folder where my untagged music is where I want to launch a script to delete all the .png and .jpg except those beginning by the word 'cover'. Here's what I tried:  find . -name '*.jpg' -or -name '*.png' -not - -name 'cover.*'   find . (-name '*.jpg' -or -name '*.png'\) -not - -name '*.png'   And other variation of the two, none worked. (I didn't included the -delete at the end on purpose)
9861
How can I use Unicode-aware regular expressions in JavaScript?  For example, there should be something akin to \w that can match any code-point in Letters or Marks category (not just the ASCII ones), and hopefully have filters like [[P*]] for punctuation, etc.
73121
I'm looking for a single line regex which does the following:  Given a HTML tag with the "name" attribute, I want to replace it with my own attribute. If that tag lacks the name attribute, I want to implant my own attribute. The result should look like this:  &lt;IMG name="img1" ...&gt; =&gt; &lt;IMG name="myImg1" ...&gt; &lt;IMG ...&gt; =&gt; &lt;IMG name="myImg1" ...&gt;   Can this be done with a single line regex?
111242
I have a , and I'm trying to match it to a regular expression to pull out some groups. The problem I'm having is that the URL can either end or continue with a "/" and more URL text. I'd like to match URLs like this:        But not match something like this:      So, I thought my best bet was something like this:    /(.+)/(\d{4}-\d{2}-\d{2})-(\d+)[/$]   where the character class at the end contained either the "/" or the end-of-line. The character class doesn't seem to be happy with the "$" in there though. How can I best discriminate between these URLs while still pulling back the correct groups?
77342
Is it possible to to change a &lt;span&gt; tag (or &lt;div&gt;) to preformat its contents like a &lt;pre&gt; tag would using only CSS?
120451
I need to be able to modify every single link in an HTML document. I know that I need to use the SoupStrainer but I'm not 100% positive on how to implement it. If someone could direct me to a good resource or provide a code example, it'd be very much appreciated.  Thanks.
57647
What's the best way to go about validating that a document follows some version of HTML (prefereably that I can specify)? I'd like to be able to know where the failures occur, as in a web-based validator, except in a native Python app.
74243
What symbols/characters are not allowed in tags?
82950
I'm in the process of moving an application from PHP to Java and there is heavy use of regular expressions in the code.  I've run across something in PHP that doesn't seem to have a java equivalent:  preg_replace_callback()   For every match in the regex, it calls a function that is passed the match text as a parameter.  As an example usage:  $articleText = preg_replace_callback("/\[thumb(\d+)\]/",'thumbReplace', $articleText); # ... function thumbReplace($matches) {    global $photos;    return "&lt;img src=\"thumbs/" . $photos[$matches[1]] . "\"&gt;"; }   What would be the ideal way to do this in Java?
121366
I want to remove every two or more spaces between specific tags and leave just a space instead:  For example:  &lt;p class="text_obisnuit"&gt;  The context of articles,   stories, and conversations helps you     figure out and understand the meaning   of English words in the text that are new to you.   &lt;/p&gt;  My desire output:  &lt;p class="text_obisnuit"&gt;The context of articles, stories, and conversations helps you figure out and understand the meaning of English words in the text that are new to you.&lt;/p&gt;  I tried something but it did not work  (?&lt;=&lt;p class="text_obisnuit"&gt;)\s*|\s*(?=&lt;/p&gt;)
13425
I'm trying to write a blog post which includes a code segment inside a &lt;pre&gt; tag. The code segment includes a generic type and uses &lt;&gt; to define that type. This is what the segment looks like:  &lt;pre&gt;     PrimeCalc calc = new PrimeCalc();     Func&lt;int, int&gt; del = calc.GetNextPrime; &lt;/pre&gt;   The resulting HTML removes the &lt;&gt; and ends up like this:  PrimeCalc calc = new PrimeCalc(); Func del = calc.GetNextPrime;   How do I escape the &lt;&gt; so they show up in the HTML?
66832
Given the below XML snippet I need to get a list of name/value pairs for each child under DataElements. XPath or an XML parser cannot be used for reasons beyond my control so I am using regex.  &lt;?xml version="1.0"?&gt; &lt;StandardDataObject xmlns="myns"&gt;   &lt;DataElements&gt;     &lt;EmpStatus&gt;2.0&lt;/EmpStatus&gt;     &lt;Expenditure&gt;95465.00&lt;/Expenditure&gt;     &lt;StaffType&gt;11.A&lt;/StaffType&gt;     &lt;Industry&gt;13&lt;/Industry&gt;   &lt;/DataElements&gt;   &lt;InteractionElements&gt;     &lt;TargetCenter&gt;92f4-MPA&lt;/TargetCenter&gt;     &lt;Trace&gt;7.19879&lt;/Trace&gt;   &lt;/InteractionElements&gt; &lt;/StandardDataObject&gt;   The output I need is:      [{EmpStatus:2.0},  {Expenditure:95465.00}, {StaffType:11.A}, {Industry:13}]    The tag names under DataElements are dynamic and so cannot be expressed literally in the regex. The tag names TargetCenter and Trace are static and could be in the regex but if there is a way to avoid hardcoding that would be preferable.   "&lt;([A-Za-z0-9]+?)&gt;([A-Za-z0-9.]*?)&lt;/"   This is the regex I have constructed and it has the problem that it erroneously includes {Trace:719879} in the results.  Relying on new-lines within the XML or any other apparent formatting is not an option.  Below is an approximation of the Java code I am using:  private static final Pattern PATTERN_1 = Pattern.compile(..REGEX..); private List&lt;DataElement&gt; listDataElements(CharSequence cs) {     List&lt;DataElement&gt; list = new ArrayList&lt;DataElement&gt;();     Matcher matcher = PATTERN_1.matcher(cs);     while (matcher.find()) {         list.add(new DataElement(matcher.group(1), matcher.group(2)));     }     return list; }   How can I change my regex to only include data elements and ignore the rest?
116796
I want to remove the newline between two html tags which exists as follows:  &lt;font&gt; &lt;/font&gt;   I want to remove the newline character such that it becomes:  &lt;font&gt;&lt;/font&gt;   Also, there might be cases where there are more than one newline(s):  &lt;font&gt;  &lt;/font&gt;   That also I want to remove to make it look like:  &lt;font&gt;&lt;/font&gt;   One more scenario,  if the pattern is like:  &lt;font&gt; This is a text &lt;/font&gt;   After, conversion it should become:  &lt;font&gt;This is a text&lt;/font&gt;   All the above scenarios are resolved, if we just truncate only the newline between two html tags. We should not be considering any white spaces.  There are couple of ways I have found it using sed, but it is very time consuming and very very efficient performance wise, particularly if the file has 1000+ html tags.