Jump to content
Search Community

split on every third semicolon gives empty results

one2gov test
Moderator Tag

Go to solution Solved by GreenSock,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

My goal is to launch js code lines as much as number in the textarea near code line. It works here 

See the Pen jVKOpL?editors=1111 by one2gov (@one2gov) on CodePen

And doesn not here  Regex works but gives me array of empty results.

lines = "tl.call(function(){clonDiv(num7); checkForDraggable(); });"
lines.split(/[^;]*;[^;]*;[^;]*;/);

result = "";

lines = "console.log("do once");"
lines.split(";");

result = "console.log("do once")";

$("#checkBtn").click(function() {
$(".textar").each(function(i, obj) {
var numbers = this.value;
numbers = numbers*1;
lines = $("#fname_call").val().split(/[^;]*;[^;]*;[^;]*;/);
console.log(lines);
// get only the current line
var test = lines[i];
//console.log(lines);
// execute current line 'numbers' times
for (var j = 0; j < numbers; j++) { 
eval(test);
}});});

How to split on every third semicolon, or have array ob strings, same as it already works here? 

See the Pen jVKOpL?editors=1111 by one2gov (@one2gov) on CodePen

See the Pen MbXWVQ?editors=1011 by one2gov (@one2gov) on CodePen

Link to comment
Share on other sites

  • Solution

Hi one2gov. Welcome to the forums. I wish we had the resources to provide free general consulting help, but we really try to keep these forums focused on GSAP-specific questions. If you need help with more general JS, perhaps StackOverflow would be a more appropriate place to post. 

 

If you have any GSAP-specific questions, we'd be happy to help. 

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...