On April 27, 2024, our Sign-in and Create Account options will be unavailable from 9am-12pm ET. During this maintenance window, developer account access and free trial registration will be unavailable.
regex help
Ok, so I'm slightly embarassed to be posting a regex help question, but I know one of you beautiful freaks out there can hook me up with a quick answer:
What's the regular expression for making a sentence "Title Case" (a.k.a. Camel Case Like This), if that sentence has an apostrophe in it.
For example, if my $string = "HERE IS A STRING", then this regex:
But, if my $string = "HERE'S A STRING", the regex above will produce "Here'S A String". (note the capital 'S' after the apostrophe).
Any love out there?
Tom
What's the regular expression for making a sentence "Title Case" (a.k.a. Camel Case Like This), if that sentence has an apostrophe in it.
For example, if my $string = "HERE IS A STRING", then this regex:
will produce "Here Is A String".
$string =~ tr/[A-Z]/[a-z]/;
$string =~ s/(\w+)/\u\L$1/g;
But, if my $string = "HERE'S A STRING", the regex above will produce "Here'S A String". (note the capital 'S' after the apostrophe).
Any love out there?
Tom
Categories
- All Categories
- Cloud Editions
- 1 Thrust Services
- cat as link
- 1 Core SaaS Application development
- 10 Developer Announcements
- 15 General Questions
- 33.4K TeamSite
- 141 Application Governance & Archiving
- 15.2K Designing Analytics Reports
- 1K DevShare Downloads
- Core SaaS Applications
- nested parent
- 4.3K Developing Analytics Applications
- 8.8K Documentum Developer Forum
- Media Management developer
- 159 Transactional Content Processing (TCP)
- 1.7K Web Experience Management
- 55 Tempo Social
- 1 XM Fax