Regex extract char

I need to extract,the text between “Thai Veggie Soup” and “Enjoy!”.I used (?<=Thai Veggie Soup\n).*?(?=\nEnjoy!),but didn’t gave result.

Thai Veggie Soup

Get started right away!
Preparation time: 10 minutes
Ingredients:
• 2 tablespoons vegetable oil
• A handful cilantro, chopped
Method:

  1. Add fish sauce, coconut milk and sugar, stir, cook for 2 minutes and take off the heat.
  2. Divide the noodles into bowls, pour the soup on top, sprinkle the cilantro and the onion on top and serve.
    Enjoy!
1 Like

Hi @prateekjain1992,

You can use the following Regex, The Group -1 gives the in-between text.

Thai Veggie Soup([\s\S]*)Enjoy!

Hope it helps, kindly mark it as a solution.

Warm Regards,
Ranjith Udayakumar

@ranjith_udayakumar
If string has Enjoy! multiple times,then how to use.

Thai Veggie Soup

Get started right away!
Preparation time: 10 minutes
Ingredients:
• 2 tablespoons vegetable oil
• A handful cilantro, chopped
Method:

  1. Add fish sauce, coconut milk and sugar, stir, cook for 2 minutes and take off the heat.
  2. Divide the noodles into bowls, pour the soup on top, sprinkle the cilantro and the onion on top and serve.
    Enjoy!
    Start Tofu and Mushrooms Soup

It’s so delicious and easy to make at home!
Preparation time: 10 minutes
Cooking time: 15 minutes
Servings: 4
Ingredients:
• 3 mushrooms, sliced
• ½ red onion, julienned
• ½ red bell pepper, julienned
• 2 garlic cloves, minced
• ½-inch ginger, grated
• 1 small Thai chili, chopped
• 2 cups veggie stock
• 14 ounces coconut milk
• 1 tablespoon coconut sugar
• 10 ounces tofu, cubed
• 1 tablespoon tamari sauce
• Juice of ½ lime
• A handful cilantro, chopped
Method:

  1. In a pot, mix the mushrooms with the onion, bell pepper, garlic, ginger, Thai chili, stock, milk, sugar and tamari sauce, toss, bring to a boil over medium heat and simmer for 10 minutes.
  2. Add the tofu and the lime juice, toss, cook for 5 minutes more, divide into bowls, sprinkle the cilantro on top and serve.
    Enjoy!

Hi @prateekjain1992,

Do you want to select till first Enjoy! or Last Enjoy!?

Warm Regards,
Ranjith Udayakumar

First Enjoy! @ranjith_udayakumar

Try with this expression
(?<=Thai Veggie Soup)(?s).+?(?=Enjoy!)

This will get only until first match of Enjoy!

Cheers @prateekjain1992

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.