Employ JavaScript regular expressions to extract all the text values from VBA code

Looking to utilize JavaScript regex in order to extract all string values from VBA code.

For instance:

If cmd = "History Report" Then
     Range("D2").Formula = "=TEXT(""" & createDate & """,""" & Replace(subtitleFormat, """", """""") & """)"
     comment = "This task is completed!"
End If

The extracted strings would be:

1> "History Report"
2> "D2"
3> "=TEXT("""
4> ""","""
5> """"
6> """"""
7> """)"
8> "This task is completed!"

Excited to explore new solutions to tackle this challenge.

Answer №2

Ensure to consider the presence of double quotation marks within string literals:

"((?:""|[^"])*)"

This pattern will identify all occurrences. The first capturing group will contain the actual strings. For including quotes in the results, utilize "(?:""|[^"])*".

Take a look at the demonstration.

Here is another regex designed specifically for this purpose:

"((?:[^"]*(?:""[^"]*)*))"

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Sharing CSS styles among multiple single-page applications (SPAs) developed using the React

I am currently working on multiple micro SPAs that exist independently within an Express environment. I am facing a challenge with importing a global CSS file that is located outside of the apps, as it is not being recognized. The use of @import url(asset ...

The jQuery Multiselect filter contradicts the functionality of single select feature

http://jsfiddle.net/rH2K6/ <-- The Single Select feature is functioning correctly in this example. $("select").multiselect({ multiple: false, click: function(event, ui){ } http://jsfiddle.net/d3CLM/ <-- The Single Select breaks down in this sc ...

Code Wizard

I am currently working on a project to develop an HTML editor. How it Needs to Function Elements Inside: Text Area - Used for typing HTML as text Iframe - Displays the typed HTML as real [renders string HTML to UI] Various Buttons Functionality: When ...

The functionality of Nodejs exec is malfunctioning

I need assistance with executing DOS commands using the exec function: java -jar D:\selenium\selenium-server-standalone-2.40.0.jar -htmlSuite "*firefox3 C:\Users\AppData\Local\Mozilla Firefox\firefox.exe" "http://google. ...

Disable the 'bouncy scrolling' feature for mobile devices

Is there a way to prevent the bouncy scrolling behavior on mobile devices? For example, when there is no content below to scroll, but you can still scroll up and then it bounces back when released. Here is my HTML structure: <html> <body> ...

Creating JSON arrays with JavaScript and jQuery

User Information var Users=[{"Id":1,"FirstName":"John"},{"Id":2,"FirstName":"Emily"}] Call Information var CallInfo=[{"Id":1,"PercentageCalls":"22 %","TotalTime":"60:24 minutes","PercentageTime":"0 %","AvgTime":"0:22 minutes"},{"Id":2,"PercentageCa ...

"The controller's $scope isn't being updated within the DIV following a routing change

My website contains ng-view partials that change based on routing updates in $routeProvider. anmSite.config(function($routeProvider, $locationProvider){ $locationProvider.html5Mode(true); $routeProvider //Home page route .when("/", { temp ...

Use jQuery to target an element by its class name and node index

I am trying to target a specific element with the class ".myclass" by its node index, but I keep encountering an error stating that the element has no "animate" function. Here is an example: <div class="myclass"></div> <div class="myclass" ...

Providing parameters to a function. What could be the issue?

Here is a link to my code on jsFiddle I am attempting to pass an argument to a function, but it seems like the argument is not being received or executed. <a href="javascript:addRemove('7249');">Details</a> This code snippet uses J ...

Performing two consecutive nested AJAX requests in jQuery using JavaScript

I am facing an issue with my code. My goal is to create a cryptocurrency ranking feature on my website. I have integrated an API that provides logos, symbols, indices, prices, etc. of cryptocurrencies. However, I encountered a problem as this API doesn&apo ...

Adding an Item to the Cart in React.js

Currently, I am delving into react.js and endeavoring to incorporate a fundamental add to cart feature. My aim is to maintain simplicity in order to grasp the entire process. The setup involves two cards - one showcasing the items and another where the sel ...

Selecting multiple elements with the same attribute value using jQuery

I am looking to target specific DOM elements using jQuery. Below is the HTML code: <li> <span class="node> <span class="con"></span> <span class="check"></span> <img> <a title="high">abc&l ...

The JavaScript object is unable to reach the PHP controller

When I attempt to send a JavaScript Object to my PHP controller, it is arriving empty. Here is the object: https://i.sstatic.net/19gFV.png Upon arrival, the object appears empty. Here is my AJAX code: https://i.sstatic.net/ekHsC.png var SendMovs = { ...

Utilize PHP's file_get_contents to trigger the Google Analytics tracking pixel

For certain goals I have set up in Google Analytics, I am unable to use the JavaScript tracking. Instead, I am interested in achieving the same result by making a call with PHP. One solution that seems straightforward to me is to invoke the URL of the tra ...

Sorting functionality malfunctioning after dynamically adding new content using AJAX

Greetings to all, I have a question about my views. 1- Index 2- Edit In the index view, I have a button and AJAX functionality. When I click the button, it passes an ID to the controller which returns a view that I then append to a div. The Edit view con ...

Guide to Embedding Content Script into Local Page

Allow me to give you an overview of the current situation; I am in the process of developing a Chrome extension that conducts searches on specific websites, retrieves the results, and then opens a new tab containing a table where all the results are displ ...

Using JavaScript, generate an array of objects that contain unique values by incrementing each value by 1

I have an array of objects called arrlist and a parameter uid If the property value has duplicate values (ignoring null) and the id is not the same as the uid, then autoincrement the value until there are no more duplicate values. How can I achieve the a ...

Modifying the values of array elements in MongoDB

I am currently attempting to modify specific elements within an array. This particular array consists of objects that have two distinct fields. The displayed output from my view is as follows: Each line in the display corresponds to the index of the objec ...

The chosen option does not display any information

I am new to databinding an html control using ajax for the first time. After checking and debugging my ajax call, I can see that the data is retrieved successfully, but it does not show up in the select option. My javascript code is positioned at the botto ...

Template does not reflect changes made to filters in real-time

I've been working on filtering my "PriceList" collection and sorting is functioning perfectly. However, I'm experiencing some issues with implementing filters and search functionality. When I click on custom filter buttons, the template doesn&apo ...