Hi,
I have been struggling with this issue. I am using Text Pipe to trim a sample of URLs to the root domains. Basically I am wanting to delete everything after the "/" including the "/" sign. I have used this regex a million times before but cant get it to work. Here is the regex:
/.*
I am using the find and replace Perl style. It should change this:
domain1.com/sometext/
domain2.com/another-piece-of text/
to:
domain1.com
domain2.com
Where am I going wrong?
Perl Regex Problem
Moderator: DataMystic Support
-
- Posts: 2
- Joined: Thu Oct 24, 2013 2:26 am
Re: Perl Regex Problem
For anyone interested this seems to work:
/.*$
Not sure why tho
/.*$
Not sure why tho
- DataMystic Support
- Site Admin
- Posts: 2328
- Joined: Mon Jun 30, 2003 12:32 pm
- Location: Melbourne, Australia
- Contact:
Re: Perl Regex Problem
You assumed that .* would stop at the end of the line- it doesn't - it consumes the rest of the file, or a large chunk of it.
That's why
/.*$
works, although
/[^\r\n]*
is better and faster.
That's why
/.*$
works, although
/[^\r\n]*
is better and faster.
Regards,
Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments
Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments