in reply to What is the Regular expression to search for boundry match for two strings?
Update: Oh, you asked for a regular expression:#!/usr/bin/perl -w use strict; my $length = 6; my $left = "xfafasfsdfasdfasdsfFOOBAR"; my $right = "FOOBAR4t11"; if ( substr($left,-$length) eq substr($right,0,$length) ) { print "Match!\n"; }
my $intersect = substr($left,-$length); if ( $right =~ /^$intersect/ ) { print "matched again!\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: What is the Regular expression to search for boundry match for two strings?
by Anonymous Monk on Apr 03, 2001 at 13:46 UTC |