Regular Expressions: Match a or b (a|b) example


Make a regular expression that matches I love cats and I love dogs but not I love logs.



I love (cats|dogs)


  1. Thanks for posting the solution to this problem. Please do keep sharing more such basic problems and their solutions for all the beginners out there.

  2. this would be really helpful for a programming student I learnt a couple of programming languages then gave up along the way I wish would match up to your skill keep up the good job

  3. office painting round rock With 30 years of experience, Kolor Pros Painting gives you the best results available. Our House Painters can handle any job, and can even repair drywall, or replace rotted wood trim. Call us today, and see what we can do for you!

  4. Car parking multiplayer mod apk is a great way to spend some time with your friends. You can race to the parking spot or try to park in a tight space. The game is easy to play and difficult to master. It is a great way to spend some time with your friends and have some fun. For more Info visit us at

  5. Driving Towards Clarity: Exploring Windshield Solutions
    Very Good And Useful information Thank For Sharing if you want to join - Windshield solutions of a vehicle is often overlooked until it's marred by cracks, chips, or blemishes. Yet, this seemingly simple pane of glass plays a crucial role in ensuring the safety and structural integrity of your vehicle. From shielding occupants from debris to providing structural support in the event of a collision, a well-maintained windshield is paramount to safe driving.
    1. Windshield Repair: Patching up Imperfections
    Small chips and cracks in a windshield may seem inconsequential at first glance, but they can quickly escalate into larger, more expensive problems if left unattended. Windshield repair solutions offer a cost-effective and timely way to address minor damage before it worsens.
    2. Windshield Replacement: A Fresh Perspective
    Advanced adhesives and installation techniques ensure a secure bond between the glass and the vehicle frame, maintaining structural integrity and preventing leaks. Additionally, opting for high-quality, OEM (Original Equipment Manufacturer) glass ensures optimal clarity and durability, meeting or exceeding industry safety standards.
    3. Mobile Windshield Services: Convenience on the Go
    Recognizing the busy schedules of modern drivers, many windshield solution providers now offer mobile services, bringing convenience directly to your doorstep. Whether you're stuck at home, at work, or on the side of the road, mobile windshield repair and replacement services allow you to address windshield issues without disrupting your day.
    4. Preventive Maintenance: Preserving Clarity for the Long Haul :Like any other component of your vehicle, regular maintenance is key to preserving the longevity and performance of your windshield. Simple practices such as cleaning the glass regularly, avoiding harsh chemicals, and promptly addressing minor damage can help extend the lifespan of your windshield and ensure optimal visibility in all driving conditions.


Follow Me

If you like our content, feel free to follow me to stay updated.


Enter your email address:

We hate spam as much as you do.

Upload Material

Got an exam, project, tutorial video, exercise, solutions, unsolved problem, question, solution manual? We are open to any coding material. Why not upload?


Copyright © 2012 - 2014 Java Problems  --  About  --  Attribution  --  Privacy Policy  --  Terms of Use  --  Contact