in reply to Re: Regular Expression to find Word Prefixes
in thread Regular Expression to find Word Prefixes
xgunnerx ... this isn't an option because of the following real life situation:
Two atomic entries found in my data set:
N'-phosphoguanidinoethyl methyl phosphate 2N N'-phosphoguanidinoethyl methyl phosphate
For the first entry your script will return the following when it should return an empty string as there is no prefix:
N'-phosphoguanidinoethyl methyl
For the second entry it will return the following when it should return "2N" as it is the prefix (note that the entire name minus prefix is not returned by your code as the 'methyl phosphate' biut is missing:
2N N'-phosphoguanidinoethyl
I admit that given the original data set that I provided your solution would work, but it does not allow for arbitrary names with spaces.
Arun
|
|---|