This project has moved and is read-only. For the latest updates, please go here.

Detect Code Reference

Jan 3, 2016 at 8:40 AM

I am trying to write a regular expression to match the following:
GetGlobalResourceObject("Strings", "the value")

I tried the bleow regex but it's not working:

Please let me know what am I doing wrong here.

Thank you,
Jan 4, 2016 at 7:26 AM
Edited Jan 4, 2016 at 7:27 AM
You must use a valid regex that matches the source, not just looks similar:
Jan 5, 2016 at 8:14 AM
Thank you very much for the code you provided.

Actually, it's still not working as expected. All of the below usage are not detected by the regex GetGlobalResourceObject("($File)"\s*,\s*"($Key)")
  1. GetGlobalResourceObject("Strings", "Company Settings")
  2. (string) GetGlobalResourceObject("Strings", "Company Settings")
  3. <%# GetGlobalResourceObject("Strings", "Company Settings") %>
The only usage which is detected properly is for the regex:
<%$ Resources:Strings,Travel Period %>

Thank you,
Jan 5, 2016 at 8:19 AM
Seems you dropped some of the "\"
Jan 6, 2016 at 8:18 AM
Edited Jan 6, 2016 at 8:23 AM
I have it correct in the program, it's trimmed when I copied it and pasted in the editor.

Here is my configuration:

It's not capturing the usage as expected.

Thank you,
Jan 7, 2016 at 9:20 AM
Can you send me a sample?
Jan 7, 2016 at 10:00 AM
For example, the below usages are not captured from the .cs files:
GetGlobalResourceObject("Strings", "Company Settings")
(string) GetGlobalResourceObject("Strings", "Company Settings")

And this usage also is not captured from the .aspx or ascx pages:
<%# GetGlobalResourceObject("Strings", "Company Settings") %>

"Company Settings" is the value and "Strings" is the file.

Thank you,
Jan 9, 2016 at 11:28 AM
Edited Jan 9, 2016 at 11:29 AM
So you have a "Strings.resx" resource in your project, with an entry "Company Settings" = "<localized string>"?
Jan 9, 2016 at 2:37 PM
Edited Jan 9, 2016 at 2:37 PM
Yes. Please check the below image:


Thank you,
Jan 9, 2016 at 3:57 PM
Jan 10, 2016 at 2:50 PM
In your screenshot, your Strings.resx files is placed directly under the root and not inside the App_GlobalResources folder. I tried the same in my project and it worked.

If the Strings.resx is inside the App_GlobalResources folder, then it will not work as expected.

For me it's OK now as long as it gives me the correct results.

Thank you very much for your time and support.

All the best,
Jan 13, 2016 at 4:52 PM
Works also if inside a sub folder: