Simple question reg string matching

Discussion in 'Perl Misc' started by K3, Oct 26, 2006.

  1. K3

    K3 Guest

    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
     
    K3, Oct 26, 2006
    #1
    1. Advertising

  2. K3

    John Bokma Guest

    "K3" <> 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/
     
    John Bokma, Oct 26, 2006
    #2
    1. Advertising

  3. K3

    K3 Guest

    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" <> 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, Oct 26, 2006
    #3
  4. K3

    John Bokma Guest

    "K3" <> 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, Oct 26, 2006
    #4
  5. K3

    John Bokma Guest

    "K3" <> 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/
     
    John Bokma, Oct 26, 2006
    #5
  6. K3

    Jim Gibson Guest

    In article <>, K3
    <> 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.
     
    Jim Gibson, Oct 26, 2006
    #6
  7. K3 <> 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
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Oct 27, 2006
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrew Rowland

    Reg exp: matching relative path only.

    Andrew Rowland, Aug 2, 2003, in forum: Perl
    Replies:
    0
    Views:
    1,146
    Andrew Rowland
    Aug 2, 2003
  2. Domenick
    Replies:
    7
    Views:
    5,027
    Domenick
    Jan 4, 2005
  3. hiwa
    Replies:
    1
    Views:
    354
    Domenick
    Jan 4, 2005
  4. K3
    Replies:
    0
    Views:
    86
  5. sivga

    reg exact string matching

    sivga, Nov 2, 2006, in forum: Perl Misc
    Replies:
    3
    Views:
    89
    Mumia W. (reading news)
    Nov 2, 2006
Loading...

Share This Page