score:0
a regex isn't able to dynamically parse a character string. let me explain: it's not possible to capture a dynamically variable number of groups.
however, this regex can match the "title" group and the first "parameters" group:
/ {#--\s+(.*?)\s+#}\s+?{#@@\s+((?:.|\n)+?)\s+#} /gm
if you wan to match all {#@@ xxx #}
groups, you must know in advance the maximum number of possible cases. it can be done with a regex like this (in case of max two parameters):
/ {#--\s+(.*?)\s+#}\s+?{#@@\s+((?:.|\n)+?)\s+#}(?:\s+?{#@@\s+((?:.|\n)+?)\s+#})? /gm
otherwise, you must do it in two steps:
- capturing all
{#@@ xxx #}
by{#-- xxx #}
in a global group - spliting this group by
{#@@ xxx #}
parts.
for further explanation, the first regex shown above can be splitted into two parts:
{#--\s+(.*?)\s+#}
for capturing{#-- xxx #}
in thegroup(1)
{#@@\s+((?:.|\n)+?)\s+#}
for capturing{#@@ xxx #}
in thegroup(2)
Source: stackoverflow.com
Related Query
- not able to extract variables from given sample
- How can i get the values of actor names from the below given json. I am able to get rest of the values but not actor names
- Not able to import decorate from mobx
- Not able to increase width of Modal from 'reactstrap' in "React JS"
- Not able to display data string from api with REACT-wysiwyg
- Not able to receive/set cookies in browser from backend in MERN app with backend hosted on heroku and frontend on netlify
- Not able to access react state from socket event handler function
- useSelector is not able to export from 'react-redux'
- Not able to get state setter from context API, getting setGlobal is not a function
- Not able to access Gitlab env variables either in node.js or react
- javascript - not able to execute the promise from array one by one
- Function inside "setInterval" does not recieve updated variables from hooks
- Not able to trigger function from event
- Not able to listen for data changes from API
- Global variables not changing as expected from methods
- Not able to call function from React Js Button Click
- Not able to set state in React Hooks using data received from Axios
- Not able to access variables in jest.mock function
- Not able to render image from API
- react - not able to import object from another js file
- Not able to pass data from HTTP post request to the javascript(expressjs) controller
- Why create-react-app alias is not able to find index.js from folder?
- Loading values from environment variables in my React application not working
- Not able to access the animate.css's animation keyframe names from scss file
- Able to get the updated state from redux store but not able to access the objects inside the updated state from the receiver component
- DatePicker not able to go away from current month and year
- After the login click i am not able to render the data that i got from Login form into the HomePage
- Sample ReactJS from reactjs.org code not working with JSX
- useMutation from react-apollo-hooks is not passing variables
- Variables not changing from React setState simultaneously
More Query from same tag
- Jquery in React is not defined
- Despite adding a unique key, react is throwing a warning
- Form validation with react and material-ui
- Re-render the same component with different parameter
- How to access up-to-date hook state outside of setInterval closure
- Finding children elements that are missing unique keys? (reactJS)
- Month jumping on date selection using react-date-range
- How do I update an array using the useContext hook?
- Node app failing during reactDOM.render()
- Trying to use redux-thunk, but it displays error even though everything seems fine to me
- React - How do I use a handleInputChange function to change a state value that is within a state value?
- Best way to dim/disable a div in Material-UI?
- react-pdf text renders in different positions
- React js quill image upload
- How to set variable in render with reactjs?
- Debouncing onChange event in React
- Convert array into array of React components separated by string
- How do I change the Heroes array, to the res array? I am using the react useState hook. This has worked on previous projects but not here
- Can't figure out what is missing in this code
- How do you render from an api in React?
- ReactJS: Nested loop rendering element in 2D without relying on array or object
- React-Query - Unit Test with react-testing-library
- Material Ui Textfield Pattern matching
- Reset formik form using mutations react query
- mocking the return of a function in enzyme
- Function for changing numbers with React doesn't work properly
- Add Babel to Typescript React app
- Why is my react router calling apis twice?
- Can you downsample an image from a websocket prior to rendering
- How to get URL from firebase storage?