# Parsing strings

**URL:** <https://www.ruby-forum.com/t/parsing-strings/130155>\
**Category:** Rails\
**Created:** [February 25, 2008, 9:57pm UTC](https://www.ruby-forum.com/t/parsing-strings/130155 "2008-02-25T21:57:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [February 25, 2008, 9:57pm UTC](https://www.ruby-forum.com/t/parsing-strings/130155/1 "2008-02-25T21:57:26Z")

</div>

I’m trying to parse ical strings (not that ical strings are all that  
special) but I’m trying to break them down for date calculations…

so if I have a value like this…

@events[0].recurrence\_rules  
=\> [“FREQ=YEARLY;INTERVAL=1;UNTIL=99991231”]

this seems so damn clumsy…

freq = “yearly” if @events[0].recurrence\_rules.to\_s =~ /FREQ=YEARLY/  
freq = “monthly” if @events[0].recurrence\_rules.to\_s =~ /FREQ=MONTHLY/

and then the interval, I would really just like the numerical value…

how can I cleanly get these values because reg expressions seem so  
clumsy

Craig
