CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions:
Need some help spliting a string

 



Ennio
Novice

Dec 12, 2009, 8:01 AM

Post #1 of 2 (2732 views)
Need some help spliting a string Can't Post

I have a string that Starts with with two letters "RN" followed by 5 numbers and some text

I need to split the string when it finds the next RN + 5 numbers. Can I get some help with the regex for it...

I have this @docs = split(m/RN[0-9]{5}/, $doc); but it doesn't give me the RN + 5 numbers...



Here is the sample data.



RN00166
ABThe pulmonary macrophages collected with bronchial mucus from
patients with cystic fibrosis and other chronic lung diseases were
investigated histochemically for acid phosphatase,
beta-glucuronidase and beta-glucosaminidase activity, and also for
mucopolysaccharide content. In macrophages from patients with
cystic fibrosis decreased beta-glucuronidase activity was observed,
together with large cytoplasmic vacuoles suggesting storage of
partially digested material. It thus seems very likely that apart
from the increased synthesis of mucopolysaccharides described in
cystic fibrosis by several authors, the degradation of
mucosubstances produced can be impaired.
RN00167
ABHL-A frequencies of 28 patients with cystic fibrosis and of 240
unrelated controls were compared. No statistically significant
difference of HL-A frequencies could be observed for both groups. A
slightly increased HL-A 2 frequency is considered a chance
phenomenon. In accordance with a previously demonstrated lacking
association of the ABH blood group substances no correlation with
certain HL-A antigens was demonstrable.

***************************************



When the data ends there is no RN this sample is the last 2 docs from the file


toolic
User

Dec 12, 2009, 12:42 PM

Post #2 of 2 (2698 views)
Re: [Ennio] Need some help spliting a string [In reply to] Can't Post

Capturing parentheses preserve the delimeter, albeit in different elements of your @docs array:

Code
@docs = split(m/(RN[0-9]{5})/, $doc);


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives