locked
Extract values from String using Regex RRS feed

  • Question

  • User1933154886 posted

    I need to extract following from below string, can anyone help

    String = "[payment is made within [ 10  ] Business Days  of its due date.]"

    Output Expected: [ 10  ] Business Days

    Friday, September 28, 2018 3:09 PM

All replies

  • User1454365735 posted

    Are the numbers of char constants before and after you want to extract ?

    If yes, have you a specific reason to use Regex?

    Saturday, September 29, 2018 10:54 AM
  • User-49720022 posted

    Why do you want to use RegEx for this, we can just use string function to get the results we want.  or Is there any reason for using Regex?

    Sunday, September 30, 2018 6:46 PM
  • User1724605321 posted

    Hi imomentsvideo,

    It's hard to give the answer without more information ,for example , does before and after [ 10  ] parts are fixed ? But as other members said , use string.Substring to extract out the parts by physical position is much simpler :

    https://www.dotnetperls.com/substring 

    Best Regards,

    Nan Yu

    Monday, October 1, 2018 2:30 AM