Click here to Skip to main content
15,922,315 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a reference list, I have to compare author's name with citation authors. I have to split the string till the year,So that I can get only author names. but I don't have an idea how to proceed further.

For example:
VB
txt="Sperrin, M., Jaki, T., & Wit, E. (2010). Probabilistic relabelling strategies for the label switching problem in Bayesian mixture models. Statistics in Computing, 20, 357-366."

- This is the text from which I have to extract the author name


I have tried so far...


VB
dim txt as string
    dim txtarray() as string
    txt="Sperrin, M., Jaki, T., & Wit, E. (2010). Probabilistic relabelling
    strategies for the label switching problem in Bayesian mixture models. 
    Statistics in Computing, 20, 357-366."
    txtarray=split(txt,",");
    'here I have to split the string till year because it will split all the
    'words which have comma with it.I need only the author's name.So, here I got 
    'struck how to get split string only till year.
    '??????

Posted
Updated 18-Feb-15 20:24pm
v2
Comments
Sergey Alexandrovich Kryukov 19-Feb-15 2:20am    
What have you tried so far? How about just using MSDN System.String help page and some simple logic?
—SA
Vidhya Raju 19-Feb-15 2:23am    
I need to stop splitting till where the year starts.

1 solution

Every entry has year in parenthesis? Try regular expressions, for instance:
C#
System.Text.RegularExpressions.Regex.Split(input, "\([12][0-9]{3}\)")
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900