0

I am a beginner in regular expression and is now stuck on something for hours. I tried multiple combinations but no success.

My task is to fetch text starting with Value= and ends with };

My solutions:

 1. (?<=Value=).*?(.+?)
 2. (?<=Value=).*?
 3. (?<=Value=).*?[^}]

These only give me a part of the expected text but not the full text

Expected Text:

-

Default

Duty Manager

Professional Employees

Mode Manager

Test String Below

[Response[attributes={Status=Success, action=Retrieve}; value=[NameList[attributes={PropertyName=Name}; value=[Names[attributes={}; value=[SimplePair[attributes={Key=-, Value=-}; value=[]], SimplePair[attributes={Key=Preferences, Value=Preferences}; value=[]], SimplePair[attributes={Key=&DEFAULT_PREFERENCE, Value=Default}; value=[]], SimplePair[attributes={Key=Profile, Value=Profile}; value=[]], SimplePair[attributes={Key=Duty Manager, Value=Duty Manager}; value=[]], SimplePair[attributes={Key=Mode User, Value=Mode User}; value=[]], SimplePair[attributes={Key=ModeDisplay Profile, Value=Mode Display Profile}; value=[]], SimplePair[attributes={Key=Mode Manager, Value=Mode Manager}; value=[]], SimplePair[attributes={Key=Professional Employees, Value=Professional Employees}; value=[]], SimplePair[attributes={Key=Scheduler, Value=Scheduler}; value=[]], SimplePair[attributes={Key=Super Access, Value=Super Access}; value=[]], SimplePair[attributes={Key=keeper, Value=keeper}; value=[]], SimplePair[attributes={Key=Manager, Value=Manager}; value=[]]]]]]]]]}
Ravi Makwana
  • 2,782
  • 1
  • 29
  • 41
Harsh Sengar
  • 95
  • 1
  • 9

1 Answers1

0

This should work

(?<=Value=).*?(?=})

demo https://regex101.com/r/J76eaa/1

Explanation of your mistakes:

(?<=Value=).*?(.+?) - this actualy makes no sense at all. "Match any but as less as possible and then match at least one and as less as possible.

(?<=Value=).*? this will match a single character. because you are saying match character as less as possible

(?<=Value=).*?[^}] - [^}] means onecharacter that is NOT } [}]is probably what you wanted, which is actually the same as just }

Superluminal
  • 947
  • 10
  • 23