Hi all,
for the following string I want to search a pattern
The string is
lcpstr = "2008/03/25 log:true lcp: 78888 -> 100 lck=0 to=900 un=5840 l=0 BMN"
If I take the pattern as "lcp: 78888", pattern checking is successful when I give the following statement:
temp = re.search("lcp:"+" "+'[0-9]+'+" ",lcpstr)
result = temp.group()
print result
The output would be:
lcp: 78888
But I basically want to have the pattern to include the last part of the pattern ie "BMN". As it denotes the boundary of the string.
But if I give "->" in the pattern, the search is not succesfull.
ie if i give :
temp = re.search("lcp:"+" "+'[0-9]+'+" "+"->"+" "+'[0-9]+'+"leq="+[0-9]+'+"lck=0 to=900 un=5840 l=0"+"BMN", lcpstr)
result = temp.group()
print result
then the search fails:
It says:
result = temp.group()
AttributeError: 'NoneType' object has no attribute 'group'
Please any one suggest me how to make the pattern string to have the last word ie "BMN" in it, as "BMN" is the bounadary marker for the string to be searched.
Regards,
Prashanth