0

i am a sample data as below

{
 CALLING_NBR = 1, / * nn svjfv ks;am scjv * /
 CALLED_NBR = 2, / * ssvdsv * / 
 EVENT_BEGIN_TIME = 3, / * * / 
 DURATION = 4, / * dhuf bvhsbv sjkncjsv jsvnjsdbv 
  the value of rthe vbisu * / 
 BILLING_PREFIX = 5 ,
 CALLING_CIRCLE_TYPE_ID = 6,

 CALL_TYPE = 7, / * call type* / 
CALLING_PREFIX = 8, / * calling e * / 

}

now using regex equation i need to remove all the data in between this /* */ sample output:-

    {
     CALLING_NBR = 1, 
     CALLED_NBR = 2, 
     EVENT_BEGIN_TIME = 3, 
     DURATION = 4,
     BILLING_PREFIX = 5,
     CALLING_CIRCLE_TYPE_ID = 6,
     CALL_TYPE = 7,
    CALLING_PREFIX = 8, 
   }

I have used this regex but no use :

Regex: (/ *)+(.*?)+(* /)*
Replacement value: $1

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
krishna
  • 25
  • 4

1 Answers1

2

For your example data, you could match what you want to remove and then replace with an empty string instead:

(?s)/ *\*.*?\* */

Regex demo

Or match 0+ times a horizontal whitespace char \h instead of a space only:

(?s)/\h*\*.*?\*\h*/
  • (?s) Dot all mode, make the dot match a newline
  • /\h*\* Match /, 0+ times a horizontal whitespace char and *
  • .*? Match any char except a newline non greedy
  • \*\h*/ match *, 0+ times a horizontal whitespace and /

Regex demo

The fourth bird
  • 154,723
  • 16
  • 55
  • 70