473,320 Members | 1,957 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

pattern match

18
hello,
i have a string(SADFDSFDSFLLSDFKFDLKFKLFDDSFLKDSKS) or something like this.
and i have a pattern (AL???LW) of five characters where ? is any one out of the sixteen alphabets given.
i have to search this pattern in the string.
language=perl
platform=linux(32 bit i686).
if anyone of u can help, plz help.
waiting
mamoon
Feb 2 '07 #1
3 1755
miller
1,089 Expert 1GB
Questions and notes:

1) Instead of a fake string, why not just tell us the real thing. That would enable us to get a more realistic feel for what you're doing.
2) Your pattern is actually 7 characters long, but you state it's "five characters"
3) "where ? is any one out of the sixteen alphabets given" - What does this mean? What is a one sixteen alphabets given? Do you mean that there are specific alphanumeric characters that fit into match those question marks? Say A through P (yes that's 16 characters).

Anyway, all those questions aside, here is a basic example that might help:

Expand|Select|Wrap|Line Numbers
  1. my $string = "SADFDSFDSFLLSDFKFDLKFKLFDDSFLKDSKS";
  2. if ($string =~ m/(SD\w{3}DL)/) {
  3.    print "Match is $1";
  4.    # Outputs SDFKFDL
  5. }
  6.  
For a first step to learning about regular expressions, start here:

http://perldoc.perl.org/perlrequick.html
Feb 2 '07 #2
KevinADC
4,059 Expert 2GB
I'm usually able to figure out questions, even poorly worded ones. But I have no idea what you are asking.
Feb 3 '07 #3
tpgames
785 512MB
hello,
i have a string(SADFDSFDSFLLSDFKFDLKFKLFDDSFLKDSKS) or something like this.
and i have a pattern (AL???LW) of five characters where ? is any one out of the sixteen alphabets given.
i have to search this pattern in the string.
language=perl
platform=linux(32 bit i686).
if anyone of u can help, plz help.
waiting
mamoon
It sounds like a game. Okay, what is being asked, I think is:
Given a certain string, and a certain pattern, find this pattern in the string. I hope this helps. And, I think he does mean 5 = # of characters in pattern. ? = one of 16 alphabets. Key, however, is not the 16 alphabets. Instead, its match the pattern in the string.

(I'd right an answer but I've only just begun to study Perl last August, and have not had time to look at it since.)
Feb 11 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Dean A. Hoover | last post by:
I've got a 4 line message that looks like this: Encountered "<EOF>" at line 1, column 7. Was expecting one of: "=" ... "]]" ... and want to get the line and column numbers from it. This is...
2
by: ahogue at theory dot lcs dot mit dot edu | last post by:
Hello - Is there any way to match complex subtree patterns with XPath? The functions I see all seem to match along a single path from root to leaf. I would like to match full subtrees. For...
5
by: Kelmen Wong | last post by:
Greeting, I want to extract all "" from a string, what pattern should I used? eg. = - return array or test1, or test2
4
by: Jéjé | last post by:
Hi, I have a file which contain 1 pair of values by line like: Name1=Value1 = I nned to store these pair of values in a sortedlist. So the result expected for the 2 samples lines is: Key ...
5
by: olaufr | last post by:
Hi, I'd need to perform simple pattern matching within a string using a list of possible patterns. For example, I want to know if the substring starting at position n matches any of the string I...
8
by: sherifffruitfly | last post by:
Hi, I've been searching as best I can for this - coming up with little. I have a file that is full of lines fitting this pattern: (?<year>\d{4}),(?<amount>\d{6,7}) I'm likely to get a...
19
by: konrad Krupa | last post by:
I'm not expert in Pattern Matching and it would take me a while to come up with the syntax for what I'm trying to do. I hope there are some experts that can help me. I'm trying to match...
3
by: konrad Krupa | last post by:
This message is a continuation of my previous post "Pattern Match" Doug - Thank you for your help. Doug Semler was able to solve my problem to some point but I still need some help. Doug's...
4
by: mosesdinakaran | last post by:
Can any one explain how the rule is applied for the following Regular expression $Str = 'the red king'; $Pattern = '/((red|white) (king|queen))/'; preg_match($Pattern,$Str,$Val); Result:
2
by: =?Utf-8?B?QWFyb24=?= | last post by:
Hi, I'm having a tricky problem where I want to accept a regular expression pattern from user input but can't get teh escape characters to be prcoessed correctly. If I take the same pattern and...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.