Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ([A-Z][a-z0-9]+)+
- ([A-Z][a-z0-9]+){2,}
- [A-Z]([A-Z0-9]*[a-z][a-z0-9]*[A-Z]|[a-z0-9]*[A-Z][A-Z0-9]*[a-z])[A-Za-z0-9]*
- [a-z]+((d)|([A-Z0-9][a-z0-9]+))*([A-Z])?
- xmlHttpRequest
- newCustomerId
- innerStopwatch
- supportsIpv6OnIos
- youTubeImporter
- youtubeImporter
- affine3D
- ([A-Z][a-z0-9]+)((d)|([A-Z0-9][a-z0-9]+))*([A-Z])?
- XmlHttpRequest
- NewCustomerId
- InnerStopwatch
- SupportsIpv6OnIos
- YouTubeImporter
- YoutubeImporter
- Affine3D
- b[A-Z][a-z]*([A-Z][a-z]*)*b
- (^[A-Z][a-z0-9]+[A-Z]$)|(^[A-Z][a-z0-9]+([A-Z][a-z0-9]+)+$)|(^[A-Z][a-z0-9]+([A-Z][a-z0-9]+)+[A-Z]$)
- 1. First character uppercase alpha
- 2. Next 1-n characters lowercase alphanumeric
- 3. Next character (n+1) uppercase alpha
- 4. Next 0 or more characters lowercase alphanumeric
- No consecutive uppercase; no special characters.
- Pattern may be repeated, e.g. NoChildLeftBehindSuite9102
- Camel01C is CamelCase syntax
- Camel01c01 is not CamelCase syntax
- Camel01C01 is CamelCase syntax
- Camel01CC01 is not CamelCase syntax
- Camel0a1c1 is not CamelCase syntax
- Camel0a1C1 is CamelCase syntax
- Camel0ac1b1C1 is CamelCase syntax
- CamelC is CamelCase syntax
- CamelC1 is CamelCase syntax
- CamelCA is not CamelCase syntax
- CamelCa1 is CamelCase syntax
- CamelCa_1 is not CamelCase syntax
- IbsReleaseTestVerificationRegressionSuite is CamelCase syntax
- IbsReleaseTestVerificationRegressioNSuite is not CamelCase syntax
- IbsReleaseTestVerificationRegressioN is CamelCase syntax
- /^[A-Z][a-z]+([A-Z][a-z]+)+/
- require 'test/unit'
- REGEX = /^[A-Z][a-z]+([A-Z][a-z]+)+/
- class RegExpTest < Test::Unit::TestCase
- # more readable helper
- def self.test(name, &block)
- define_method("test #{name}", &block)
- end
- test "matches camelcased word" do
- assert 'FooBar'.match(REGEX)
- end
- test "does not match words starting with lower case" do
- assert ! 'fooBar'.match(REGEX)
- end
- test "does not match words without camel hump" do
- assert ! 'Foobar'.match(REGEX)
- end
- test "matches multiple humps" do
- assert 'FooBarFizzBuzz'.match(REGEX)
- end
- end
- ([A-Z][a-zd]+)+
- ([A-Z]+[a-z0-9]+)+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement