List Info

Thread: A regx sample




A regx sample
country flaguser name
United States
2007-07-20 04:14:41
Hi,
  I am new to the list and Regex. I am using posix compliant
regex. I
would like to find <img ....> tags in html and to
replace it

Let me give an example

The input text

<IMG align=3Dbottom =
border=3D0=20
 height=3D45
src=3D"cid:FBF0FAB9BC9E4E319BBD648467E160C9RCCF024"=20

width=3D59>

I want to replace the "
src=3D"cid:FBF0FAB9BC9E4E319BBD648467E160C9RCCF024"=20 "

with

src="/home/xyz.jpeg"

How can I do this?

can somebody tell me how to find out the "src"
inside an img tag?

Thank you very much,
  Lloyd


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---


Re: A regx sample
country flaguser name
United States
2007-07-23 09:47:34
Hi Lloyd,

Does this wrap over several lines (as in your example), or
is it one
line always?

Thanks!
Syd

On Jul 20, 2:14 pm, Lloyd <lloy...gmail.com> wrote:
> Hi,
>   I am new to the list and Regex. I am using posix
compliant regex. I
> would like to find <img ....> tags in html and to
replace it
>
> Let me give an example
>
> The input text
>
> <IMG align=3Dbottom =
> border=3D0=20
>  height=3D45
src=3D"cid:FBF0FAB9BC9E4E319BBD648467E160C9RCCF024"=20
>
> width=3D59>
>
> I want to replace the "
> src=3D"cid:FBF0FAB9BC9E4E319BBD648467E160C9RCCF024"=20 "
>
> with
>
> src="/home/xyz.jpeg"
>
> How can I do this?
>
> can somebody tell me how to find out the
"src" inside an img tag?
>
> Thank you very much,
>   Lloyd


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---


Re: A regx sample
user name
2007-07-23 22:58:33
Hi Syd,
&nbsp; Thanks for your intension to help me. Yes, it wraps in multiple lines. I am trying to process an email and trying to replace the "cid&quot; tag with an(file sysem) path.

Regards,
  Lloyd


On 7/23/07, sydchesgmail.com">sydchesgmail.com < sydchesgmail.com">sydchesgmail.com> wrote:

Hi Lloyd,

Does this wrap over several lines (as in your example), or is it one
line always?

Thanks!
Syd

On Jul 20, 2:14 pm, Lloyd < lloy...gmail.com">lloy...gmail.com > wrote:
>; Hi,
>&nbsp;  I am new to the list and Regex. I am using posix compliant regex. I
> would like to find <img ....> tags in html and to replace it
>
&gt; Let me give an example
&gt;
> The input text
>
> <IMG align=3Dbottom =
> border=3D0=20
>&nbsp; height=3D45 src=3D&quot;cid:FBF0FAB9BC9E4E319BBD648467E160C9RCCF024&quot;=20
>
> width=3D59>
>
&gt; I want to replace the "
&gt; src=3D&quot;cid:FBF0FAB9BC9E4E319BBD648467E160C9RCCF024&quot;=20 "
>;
> with
>
> src="/home/xyz.jpeg"
&gt;
> How can I do this?
>
> can somebody tell me how to find out the "src&quot; inside an img tag?
>;
> Thank you very much,
>  ; Lloyd

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/regex
-~----------~----~----~----~------~----~------~--~---

Re: A regx sample
country flaguser name
United States
2007-07-30 09:58:23
Hi Lloyd,

A brief struggle with Perl later....

*************************************Begin
Code*************************************
#!/usr/bin/perl -w
use strict;

my $data;
my $replaced;
my $file;

open(OUT, ">C:\Perl\Test\Output.txt");
$file = "C:\Perl\Test\Input.txt";

{
local $/;
open SLURP, $file or die "Could not open $file:
$!";
$data = <SLURP>;
$data =~
s#(<IMG[^42]+)(src=)3D(42)([^42]+)(42)S+#$1$2$3/
home/
xyz.jpeg$5#m;
close SLURP or die "cannot close $file: $!";
print OUT "$data";
close OUT;
}

*************************************End
Code*************************************

This worked for me. Do let me know how it goes!

Thanks
Sydney

On Jul 24, 8:58 am, "Lloyd K.L" <lloy...gmail.com> wrote:
> Hi Syd,
>   Thanks for your intension to help me. Yes, it wraps
in multiple lines. I
> am trying to process an email and trying to replace the
"cid" tag with
> an(file sysem) path.
>
> Regards,
>   Lloyd
>
> On 7/23/07, sydc...gmail.com <sydc...gmail.com> wrote:
>
>
>
>
>
> > Hi Lloyd,
>
> > Does this wrap over several lines (as in your
example), or is it one
> > line always?
>
> > Thanks!
> > Syd
>
> > On Jul 20, 2:14 pm, Lloyd <lloy...gmail.com> wrote:
> > > Hi,
> > >   I am new to the list and Regex. I am using
posix compliant regex. I
> > > would like to find <img ....> tags in
html and to replace it
>
> > > Let me give an example
>
> > > The input text
>
> > > <IMG align=3Dbottom =
> > > border=3D0=20
> > >  height=3D45
src=3D"cid:FBF0FAB9BC9E4E319BBD648467E160C9RCCF024"=20
>
> > > width=3D59>
>
> > > I want to replace the "
> > >
src=3D"cid:FBF0FAB9BC9E4E319BBD648467E160C9RCCF024"=20 "
>
> > > with
>
> > > src="/home/xyz.jpeg"
>
> > > How can I do this?
>
> > > can somebody tell me how to find out the
"src" inside an img tag?
>
> > > Thank you very much,
> > >   Lloyd- Hide quoted text -
>
> - Show quoted text -


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---


[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )