Parse line to get N values
up vote
0
down vote
favorite
I need help to get the N dates that could be in this line:
"vmsnapshot":"Snapshot 1 created on dom ago 5 11:03:09 -04 2018.
Info: OFF Snapshot solicitado según INC000001850649. Snapshot 2
created on dom ago 26 02:44:44 -03 2018. Info: OFF
user-VCD-snapshot-ab221cb8-539d-456a-8732-8500ec7fefa6-. "
I just need to rescue the dates, I have some ideas like adding it to an arrangement, but maybe there is something more optimal to do it.
Example result :
- ago 5 2018
- ago 26 2018
Thank you
javascript arrays parsing
add a comment |
up vote
0
down vote
favorite
I need help to get the N dates that could be in this line:
"vmsnapshot":"Snapshot 1 created on dom ago 5 11:03:09 -04 2018.
Info: OFF Snapshot solicitado según INC000001850649. Snapshot 2
created on dom ago 26 02:44:44 -03 2018. Info: OFF
user-VCD-snapshot-ab221cb8-539d-456a-8732-8500ec7fefa6-. "
I just need to rescue the dates, I have some ideas like adding it to an arrangement, but maybe there is something more optimal to do it.
Example result :
- ago 5 2018
- ago 26 2018
Thank you
javascript arrays parsing
Be clear. Are you asking to extract the dates from data represented as a string? What have you tried? Asking for a solution to even simple things is generally not going to get you much traction here. Hint: a naive approach is regular expressions: regex101.com
– jdv
Nov 7 at 15:16
@Manuel welcome to SO! What programming language do you use?
– Ivan Zaruba
Nov 7 at 15:38
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I need help to get the N dates that could be in this line:
"vmsnapshot":"Snapshot 1 created on dom ago 5 11:03:09 -04 2018.
Info: OFF Snapshot solicitado según INC000001850649. Snapshot 2
created on dom ago 26 02:44:44 -03 2018. Info: OFF
user-VCD-snapshot-ab221cb8-539d-456a-8732-8500ec7fefa6-. "
I just need to rescue the dates, I have some ideas like adding it to an arrangement, but maybe there is something more optimal to do it.
Example result :
- ago 5 2018
- ago 26 2018
Thank you
javascript arrays parsing
I need help to get the N dates that could be in this line:
"vmsnapshot":"Snapshot 1 created on dom ago 5 11:03:09 -04 2018.
Info: OFF Snapshot solicitado según INC000001850649. Snapshot 2
created on dom ago 26 02:44:44 -03 2018. Info: OFF
user-VCD-snapshot-ab221cb8-539d-456a-8732-8500ec7fefa6-. "
I just need to rescue the dates, I have some ideas like adding it to an arrangement, but maybe there is something more optimal to do it.
Example result :
- ago 5 2018
- ago 26 2018
Thank you
javascript arrays parsing
javascript arrays parsing
edited Nov 7 at 15:25
Luca Kiebel
7,30641431
7,30641431
asked Nov 7 at 15:02
Manuel
1
1
Be clear. Are you asking to extract the dates from data represented as a string? What have you tried? Asking for a solution to even simple things is generally not going to get you much traction here. Hint: a naive approach is regular expressions: regex101.com
– jdv
Nov 7 at 15:16
@Manuel welcome to SO! What programming language do you use?
– Ivan Zaruba
Nov 7 at 15:38
add a comment |
Be clear. Are you asking to extract the dates from data represented as a string? What have you tried? Asking for a solution to even simple things is generally not going to get you much traction here. Hint: a naive approach is regular expressions: regex101.com
– jdv
Nov 7 at 15:16
@Manuel welcome to SO! What programming language do you use?
– Ivan Zaruba
Nov 7 at 15:38
Be clear. Are you asking to extract the dates from data represented as a string? What have you tried? Asking for a solution to even simple things is generally not going to get you much traction here. Hint: a naive approach is regular expressions: regex101.com
– jdv
Nov 7 at 15:16
Be clear. Are you asking to extract the dates from data represented as a string? What have you tried? Asking for a solution to even simple things is generally not going to get you much traction here. Hint: a naive approach is regular expressions: regex101.com
– jdv
Nov 7 at 15:16
@Manuel welcome to SO! What programming language do you use?
– Ivan Zaruba
Nov 7 at 15:38
@Manuel welcome to SO! What programming language do you use?
– Ivan Zaruba
Nov 7 at 15:38
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Consider using regular expressions as it is usually the best approach for that kind of tasks.
In your case it will be something like this (JavaScript example)
https://regex101.com/r/nJ9JfD/1/
Group 1 will capture ago <1 or more digits>
Group 2 will capture <space><any four digits>
Combining result of those two groups will give you the expected output.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Consider using regular expressions as it is usually the best approach for that kind of tasks.
In your case it will be something like this (JavaScript example)
https://regex101.com/r/nJ9JfD/1/
Group 1 will capture ago <1 or more digits>
Group 2 will capture <space><any four digits>
Combining result of those two groups will give you the expected output.
add a comment |
up vote
0
down vote
Consider using regular expressions as it is usually the best approach for that kind of tasks.
In your case it will be something like this (JavaScript example)
https://regex101.com/r/nJ9JfD/1/
Group 1 will capture ago <1 or more digits>
Group 2 will capture <space><any four digits>
Combining result of those two groups will give you the expected output.
add a comment |
up vote
0
down vote
up vote
0
down vote
Consider using regular expressions as it is usually the best approach for that kind of tasks.
In your case it will be something like this (JavaScript example)
https://regex101.com/r/nJ9JfD/1/
Group 1 will capture ago <1 or more digits>
Group 2 will capture <space><any four digits>
Combining result of those two groups will give you the expected output.
Consider using regular expressions as it is usually the best approach for that kind of tasks.
In your case it will be something like this (JavaScript example)
https://regex101.com/r/nJ9JfD/1/
Group 1 will capture ago <1 or more digits>
Group 2 will capture <space><any four digits>
Combining result of those two groups will give you the expected output.
answered Nov 7 at 15:46
Ivan Zaruba
1,117721
1,117721
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53192099%2fparse-line-to-get-n-values%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Be clear. Are you asking to extract the dates from data represented as a string? What have you tried? Asking for a solution to even simple things is generally not going to get you much traction here. Hint: a naive approach is regular expressions: regex101.com
– jdv
Nov 7 at 15:16
@Manuel welcome to SO! What programming language do you use?
– Ivan Zaruba
Nov 7 at 15:38