Victor Victor - 1 year ago 96
Ruby Question

Match joined sentences by period with Regex

Using Ruby. Here's a sample text:

The ride costs E£4. It's worth having a torch to illuminate badly lit
areas.Most tombs described here are usually open to visitors. They are
listed in the order that they are found when entering the site. The
best source of information about the tombs, their decoration and
history is the Theban Mapping Project
( of Ramses VII (KV 1) Near the main
entrance is the small, unfinished tomb of Ramses VII (1136-1129 BC).
Only 44.3m long - short for a royal tomb because of Ramses' sudden
death - it consists of a corridor, a burial chamber and an unfinished
third chamber.

I tried the following, but it matches together with the next capital letter:

/\.[A-Z]/ #=> matches .T instead of .

I want to:

  • match the period
    only - any dot that is followed by a capital letter,

  • not match

  • not match

Answer Source

have you tried?


it will match for any dot follow by capital letters

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download