JSFiddle - React, Tailwind, and code Playground

by ckissi

HTML

<textarea id="t">
            $table->foreignId('user_id')->constrained()->onUpdate('cascade')->onDelete('cascade');
            $table->foreignId('applicant_id')->constrained()->onUpdate('cascade')->onDelete('cascade');
            $table->string('name')->nullable();
            $table->integer('number');
            $table->bigInteger('reality_office_id');
            $table->integer('real_estate_id')->nullable();
            $table->enum('real_estate_type',['flat','family_house','commecial_space','land','other']);
            $table->enum('reason',['purchase','rent','sell']);
            $table->string('real_estate_type_description')->nullable();
            $table->string('real_estate_street')->nullable();
            $table->string('real_estate_street_number')->nullable();
            $table->string('real_estate_zip')->nullable();
            $table->string('real_estate_city')->nullable();
            $table->text('real_estate_notes')->nullable();
            $table->enum('method_of_financing',['cash','mortgage']);
            $table->string('ltv')->nullable();
            $table->enum('financial_agent_interest',['no','yes']);
            $table->string('bank')->nullable();
            $table->enum('mortgage_offer_interest',['no','yes']);
            $table->enum('interested',['yes','no','not_decided']);
            $table->enum('fine_for_circumvention_of_cooperation',['yes','no','not_decided'])->nullable();            
            $table->enum('proc_of_pers_data',['yes','no'])->default('no');
            $table->enum('proc_of_pers_data_marketing',['yes','no'])->default('no');
            $table->boolean('locked')->default(0);
            $table->text('payload')->nullable();
            $table->datetime('realized_on')->nullable();
            $table->timestamps();
</textarea>

JavaScript

const str = "$table->foreignId('applicant_id')->constrained()->onUpdate('cascade')->onDelete('cascade');"
var rg = /\(\'([^\']*)/m;
var match = rg.exec(str);
console.clear();
var lines = document.getElementById("t").value.split('\n');
for(let line of lines) {
  var match = rg.exec(line);
  try {
		console.table(match[1]);
  }  catch(error) {
  	 
  }
}