I need to remove the first forward slash inside link formatted like this:
/directory/link.php
I need to have:
directory/link.php
I'm not literate in regular expressions (preg_replace?) and those slashes are killing me..
I need your help stackoverflow!
Thank you very much!
...
My regular expression has 2 different outputs from the same code... but i don't know what's wrong. Here's a piece of code, i hope you can help me. Thanks!
String s = "48° 18′ 13,94″ nördliche Breite, "
+ "11° 34′ 31,98″ östliche Länge";
String kommazahl = "[0-9]{1,2}([\\.,][0-9]+)?";
String zahl = "[0-9]{1,2}";
Pattern p1 = P...
Hi, I have created a program that allows me to search for keywords inside the code of stored procedures, functions, tables etc. in SQL Server generated text files. I am looking for a way to find out where a search term (i.e "ADMIN.TABLE) is being referenced in all the code files. I use LINQ to find references. For example when I search f...
I'm trying to create a loose word wrapping system via a regex in Perl. What I would like is about every 70 characters or so to check for the next whitespace occurrence and replace that space with a newline, and then do this for the whole string. The string I'm operating on may already have newlines in it already, but the amount of text b...
I have a string I read from a configuration file. Structure of the string is as follows;
(long_string)long_string(long_string)
Any item in brackets, including the brackets themselves, are optional. I have the following regular expression matching the whole string but I could not figure out how to make some parts of the regular express...
I am trying to match strings like '[sometext<someothertext>]' (i.e., left square bracket, text, left angle bracket, text, right angle bracket, right square bracket) within a column in mySQL. Originally I used the following query (notice that since regex queries are escaped twice in mySQL, you must use two backslashes where you would norm...
I'm using the jQuery Autocomplete plugin, but I'm having some problems with the result highlighting. When a match is found, but the entered keyword contains spaces, there's no highlighting. Example:
search = "foo", result = "foo bar", displayed = "foo bar"
search = "foo ba", result = "foo bar", displayed = "foo bar"
So, I'm trying to ...
Hi,
I have a tricky issue redirecting some urls internally for my site.
The situation is this, I currently have a url like example.com/check/youtube.com which internally redirects to check.php?domain=youtube.com using the following mod_rewrite code:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
Rewr...
With PCRE, how can you construct an expression that will only match if a string is not found.
If I were using grep (which I'm not) I would want the -v option.
A more concrete example: I want my regexp to match iff string foo is not in the string. So it would match bar would but not foobar.
...
I'm having some difficulty with a specific Regex I'm trying to use. I'm searching for every occurrence of a string (for my purposes, I'll say it's "mystring") in a document, EXCEPT where it's in a tag, e.g.
<a href="_mystring_">
should not match, but
<a href="someotherstring">_mystring_</a>
Should match, since it's not inside a ta...
Hi,
So I'm quite new to programming in general, so this may be a stupid question, but I am specifically trying to use regexes to strip a CSS tag. Basically I have this:
.style1 {
font-size: 24px;
font-weight: bold;
color: #FFEFA1;
}
and I want it to look like this:
.style1:color:#FFEFA1
I want to maintain the s...
Is there a cleaner way to write long regex patterns in python? I saw this approach somewhere but regex in python doesn't allow lists.
patterns = [
re.compile(r'<!--([^->]|(-+[^->])|(-?>))*-{2,}>'),
re.compile(r'\n+|\s{2}')
]
...
Hi, I need some help with creating a regex for my php script. Basically, I have an associative array containing my data, and I want to use preg_replace to replace some place-holders with real data. The input would be something like this:
<td>{{address}}</td><td>{{fixDate}}</td><td>{{measureDate}}</td><td>{{builder}}</td>
I don't wan...
Hi
I have this HTML string which often has a lot of whitespaces
Example:
<p>All these words <br />
<strong>All</strong> <em>these</em> words
<pre> All these words</pre>
</p>
I need to remove them using JavaScript, and have come up with this regEx:
String.replace(/ {2,}/g, '');
Which seems to do the job with replacin...
I have the following template String: "Hello [Name] Please find attached [Invoice Number] which is due on [Due Date]".
I also have String variables for name, invoice number and due date - what's the best way to replace the tokens in the template with the variables?
(Note that if a variable happens to contain a token it should NOT be ...
Hello,
I'm really sorry if this has been answered before but I just can't seem to find the proper answer. I have a string in JS and it includes an href tag. I want to remove all links AND the text. I know how to just remove the link and leave the inner text but I want to remove the link completely.
For example:
var s = "check this out...
Hi,
I have a list of words that should be replaced on
HTML page, but only if word is not inside a list of tags (like A B I)
So if there is text :
<p> some text and XXX term <a href="http://some-XXX-bla.com">good morning XXX world</a> other text and XXX term <b>another XXX inside other sentance</b> </p>
and XXX should be replaced...
I'm having trouble writing a regular expression (suitable for PHP's preg_match()) that will parse keyword='value' pairs regardless of whether the <value> string is enclosed in single or double quotes. IOW in both of the following cases I need to get the <name> and <value> where the <value> string may contain the non-enclosing type of quo...
In Java, is there a simple way to extract a substring by specifying the regular expression delimiters on either side, without including the delimiters in the final substring?
For example, if I have a string like this:
<row><column>Header text</column></row>
what is the easiest way to extract the substring:
Header text
Please note ...
[EDITED - really sorry, the code I quoted was wrong - have changed the message below to reflect this. Apologies! Thank you for your patience.]
I'm new to regular expressions and want to match a pattern in Java (following on from this solution - http://stackoverflow.com/questions/962122/java-string-get-everything-between-but-not-includi...