For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > October 2006 > Simple question reg string matching









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Simple question reg string matching
K3

2006-10-30, 7:10 pm

I am a newbie to perl, so i wud appreciate if anyone give the code for
finding the number of matches in a given string, allowing atmost m no
of mismatches.

input: short string (len = k)
long string (len =n)
no of mismatches (=m)

output: no of matches allowing m mismatches
cheers
karthik

John Bokma

2006-10-30, 7:10 pm

"K3" <kjkartik@gmail.com> wrote:

> I am a newbie to perl, so i wud appreciate if anyone give the code for
> finding the number of matches in a given string, allowing atmost m no
> of mismatches.
>
> input: short string (len = k)
> long string (len =n)
> no of mismatches (=m)
>
> output: no of matches allowing m mismatches


CPAN or pay someone for doing your homework.

--
John Experienced Perl programmer: http://castleamber.com/

Perl help, tutorials, and examples: http://johnbokma.com/perl/
K3

2006-10-30, 7:10 pm

John

I know how to do that thing normally. But if u can give me some
efficient code, I wud appreciate ur help.

cheers
karthik

John Bokma wrote:
> "K3" <kjkartik@gmail.com> wrote:
>
>
> CPAN or pay someone for doing your homework.
>
> --
> John Experienced Perl programmer: http://castleamber.com/
>
> Perl help, tutorials, and examples: http://johnbokma.com/perl/


John Bokma

2006-10-30, 7:10 pm

"K3" <kjkartik@gmail.com> wrote:

> John
>
> I know how to do that thing normally. But if u can give me some
> efficient code, I wud appreciate ur help.


u'v 2 lk @ cpan


--
John Experienced Perl programmer: http://castleamber.com/

Perl help, tutorials, and examples: http://johnbokma.com/perl/
John Bokma

2006-10-30, 7:10 pm

"K3" <kjkartik@gmail.com> wrote:

> John
>
> I know how to do that thing normally.


Write the code, profile it, and if you don't know how to speed it up, post
it here. There are plenty of people here willing to /improve/ code.

--
John Experienced Perl programmer: http://castleamber.com/

Perl help, tutorials, and examples: http://johnbokma.com/perl/
Jim Gibson

2006-10-30, 7:10 pm

In article <1161891126.760608.112970@b28g2000cwb.googlegroups.com>, K3
<kjkartik@gmail.com> wrote:

> I am a newbie to perl, so i wud appreciate if anyone give the code for
> finding the number of matches in a given string, allowing atmost m no
> of mismatches.
>
> input: short string (len = k)
> long string (len =n)
> no of mismatches (=m)
>
> output: no of matches allowing m mismatches


In addition to following John's excellent advice, you will need (for
me, anyway) to define what you mean by a 'mismatch', with examples.

For example, if the string to be tested is 'aababcaabd' against the
pattern 'ab', I can see that there are 3 matches. However, I don't know
the number of mismatches. It could be 3 ('a', 'ca', 'd') or 6 ('aa',
'ba', 'bc', 'ca', 'aa', 'bd') or maybe something else, depending upon
how you define a mismatch.
Tad McClellan

2006-10-30, 7:10 pm

K3 <kjkartik@gmail.com> wrote:

> I know how to do that thing normally.



Then post your code, and we will help you improve it.



> But if u can give me some

^
> efficient code, I wud appreciate ur help.

^^^ ^^

Please use real English.

You are being inconsiderate of those who don't have English
as their first language.


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com