The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
From: Daniel Sobral <dcsob...@gmail.com>
Date: Fri, 1 Jul 2011 11:34:01 -0300
Local: Fri, Jul 1 2011 10:34 am
Subject: Re: [scala-user] missing a good documentation
2011/6/30 François Gannaz <francois.gan...@gmail.com>:
> About scala.util.Regex, I had a hard time to handle some simple tasks, like I missed this comment... Yes, I know *exactly* how you feel. Some ways > getting a collection of the groups for all the matches of a pattern in a given > string. Something like ` push @a,$1 for /id=(\d+)/g ` in Perl. of doing it: val a = for { } yield matched.subgroups(0) val a = for { matched <- """id=(\d+)""".r.findAllIn(source).matchData.toList } yield matched.group(1) val a = for { matched <- """id=(\d+)""".r.findAllIn(source).matchData.toList groups <- matched.subgroups } yield groups val a = """id=(\d+)""".r.findAllIn(source).matchData.flatMap(_ subgroups).toList // The following examples need this import val a = for { } yield first val a = for { Groups(first) <- """id=(\d+)""".r.findAllIn(source).matchData.toList } yield first // If you have many subgroups, but only care about the first val a = for { Groups(first, _ @ _*) <- """id=(\d+)""".r.findAllIn(source).matchData.toList } yield first // The following example needs the pattern to be assigned to an identifier val pattern = """id=(\d+)""".r val a = for { pattern(first) <- pattern.findAllIn(source).matchData.toList } yield first -- Daniel C. Sobral I travel to the future all the time. You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||