Would anyone be able to tell me how to pull the server name out of a UNC?
ex.
//servername/directory/directory
Edit
:
I apologize but it looks like I need to clarify a mistake: the path actually is more like:
//servername/d$/directory
I know this might change things a little
...
Hey,
I'm looking for a nice tight regex solution to this problem. I'm looking to reformat an UNC into a Uri
Problem:
UNC directory needs to be reformatted into a Uri
\\server\d$\x\y\z\AAA
needs to look like:
http://server/z/AAA
...
Does anyone know a PHP RegEx to allow only relative paths, not absolute?
For example, I have an AJAX function that submits this value to my PHP script "some-directory/another-directory/some-file.php".
My PHP script then includes that file.... include($some-php-document);
I don't want a hacker to be able to use my AJAX function to subm...
How can I use Perl regexps to extract all URLs of a specific domain (with possibly variable subdomains) with a specific extension from plain text. I have tried:
my $stuff = 'omg http://fail-o-tron.com/bleh omg omg omg omg omg http://homepage.com/woot.gif dfgdfg http://shomepage.com/woot.gif aaa';
while($stuff =~ m/(http\:\/\/.*?homepage...
I screwed up my last post. Lets see if I can get this one right..
Would anyone be able to tell me how to pull the server name out of a UNC? (I'm looking for a regex)
this is the string I want to pull the servername from:
**\\\servername\d$\directory**
My Code is in C#
Regex r = new Regex(?????, RegexOptions.IgnoreCase);
Match m =...
Is there a way to match a pattern (e\d\d) several times, capturing each one into a group? For example, given the string..
blah.s01e24e25
..I wish to get four groups:
1 -> blah
2 -> 01
3 -> 24
4 -> 25
The obvious regex to use is (in Python regex:
import re
re.match("(\w+).s(\d+)e(\d+)e(\d+)", "blah.s01e24e25").groups()
..but I al...
Hi,
I am using the jquery validation plugin from: http://bassistance.de/jquery-plugins/jquery-plugin-validation/
How can I add a regex check on a particular textbox?
I want to check to make sure the input is alphanumeric.
...
^(?!-)[a-z\d\-]{1,100}$
...
I'm working on an app in CodeIgniter, and I am trying to make a field on a form dynamically generate the URL slug. What I'd like to do is remove is punctuation, convert it to lowercase, and replace the spaces with hyphens. So for example, Shane's Rib Shack would become shanes-rib-shack.
Here's what I have so far. the lowercase part was ...
How do I convert the string:
"Microsoft Windows XP Professional x64 Edition|C:\\WINDOWS|\\Device\\Harddisk4\\Partition1"
to
"Microsoft Windows XP Professional x64 Edition"
...using regular expressions?
I want to cut out all after | symbol. Is it easy to realise it via Regex.Replace? Where could I found syntax description for Rege...
With PHP, I'd like to use a preg_replace() filter for passwords such that the only characters available for passwords are US ASCII typable, minus control codes and NULL.
What's the RegEx to achieve that which I can plugin to preg_replace()?
EDIT:
I've been advised to edit this question since I "get it" now and won't be doing this terr...
I'm looking for a pattern equivalent to \w, and which doesn't match numeric pattern.
I cannot use [a-zA-Z] because I would like it to match japanese kanjis as well.
Is there a way to write something like [\w^[0-9]] ?
Is there an equivalent of [:alpha:] in python regex?
...
Most probably I'm missing something obvious here, but why do I need to call the search/replace regex twice to have any effect in the following code? If I call it only once, the replacement doesn't take place :-(
use strict;
use warnings;
use LWP::Simple;
my $youtubeCN = get(shift @ARGV);
die("Script tag not found!\n")
unless $youtubeC...
I've a list of possible urls on my site like
1 http://dev.site.com/People/
2 http://dev.site.com/People
3 http://dev.site.com/Groups/
4 http://dev.site.com/Groups
5 http://dev.site.com/
6 http://dev.site.com/[extraword]
I want to be able to match all the urls like 6 and redirect them to
http://dev.site.com/?Shorturl=extraword
but I do...
This seems redundant, running perl from a Perl script itself.
my $Pref = "&*())(*&^%$#@!";
system("perl -pi -e 's|^SERVERNAME.*\$|SERVERNAME \"\Q$Pref\E\"|g' pserver.prefs");
What is the actual Perl code that will mimic -pi? I just want something that would work like sed on Perl, just as simple as can be.
Based on Todd Gardner's s...
Hi,
I need a regular expression to validate a timestamp of the format, using Javascript:
YYYY/MM/DD HH:MI:SS
I tried cooking up a few, but seems my regex skills fail to cover something or other.
Please give me a reference or way to do it.
P.S. : I mention regex, only as a suggestion. Im using Javascript and welcome any alternati...
If I want all the lines with the text 'ruby' but not 'myruby' then this is what I would do.
:g/\<ruby\>/
My question is what is the meaning of lesser than and greater than symbol here? The only regular expression I have used is while programming in ruby.
Similarly if I want to find three consecutive blank lines then this is what I wo...
Using regular expressions in C#, is there any way to find and remove duplicate words or symbols in a string containing a variety of words and symbols?
Ex.
Initial string of words:
"I like the environment. The environment is good."
Desired string:
"I like the environment. is good"
Duplicates removed: "the", "environment", "."
...
I really like the IIS7 URL rewriting module and so far, it worked great for me.
There is one thing that I'm not sure how to do: I would like to permanently redirect all URLs that have encoded spaces (%20) in them to a URL that has the spaces replaced with a dash (-).
So this:
http://www.test.com/About%20Our%20Mission.aspx
should be...
I tried removing all newlines (\n) from the values of a hash:
my %var_h = ( "ID" => " This is Test
This is new line TEST
newline Test end ");
How can I remove all the new lines from the values of %var_h?
I tried s/\\n//g but I could not get it to work.
...