import re
regex = re.compile(r"\>(^($|\<\>)|[A-Z a-z0-9\,\.\/\)\(\*\+\:\-]{2,}+)\<\/", flags=re.MULTILINE)
test_str = ("@extends('layouts.index')\n"
"@section('styles')\n"
"<style>\n"
" @media screen and (max-width: 1000px) {\n"
" .btn {\n"
" border-radius: 0.5rem !important;\n\n\n"
" margin-top: 20px;\n"
" width: 100%;\n"
" }\n\n"
" #q {\n"
" border-radius: 0px;\n"
" }\n"
" }\n"
"</style>\n"
"@endsection\n"
"@section('title')\n"
"<title>\n"
" {{ 'Jobs - '.config('app.name')}}\n"
"</title>\n"
"@endsection\n"
"@section('content')\n"
"<div class=\"container-fluid py-4\">\n\n"
" <form action=\"{{route('jobs.list')}}\" method=\"GET\">\n"
" <div class=\"row g-0\">\n"
" <div class=\"col-lg-3 col-6\">\n"
" <input id=\"q\" name=\"q\" class=\"form-control\" value=\"@if(isset($_GET['q'])){{$_GET['q']}}@endif\" type=\"text\" style=\"border-bottom-right-radius: 0px; border-top-right-radius: 0px\" placeholder=\"Search jobs\" autocomplete=\"off\">\n"
" </div>\n"
" <div class=\"col-lg-2 col-6\">\n"
" <select class=\"form-select\" name=\"category\" id=\"category\" style=\"border-radius: 0px;\" aria-label=\"Default select example\">\n"
" <option value=\"\" selected>Categories</option>\n"
" @foreach($categories as $category)\n"
" <option value=\"{{$category->slug}}\">{{$category->name}}</option>\n"
" @endforeach\n"
" </select>\n"
" </div>\n"
" <div class=\"col-lg-2 col-6\">\n"
" <select class=\"form-select\" name=\"job_type\" id=\"job_type\" style=\"border-radius: 0px;\" aria-label=\"Default select example\">\n"
" <option value=\"\" selected>Job Type</option>\n"
" <option value=\"Part Time\">Part Time</option>\n"
" <option value=\"Full Time\">Full Time</option>\n"
" </select>\n"
" </div>\n"
" <div class=\"col-lg-2 col-6\">\n"
" <select class=\"form-select\" name=\"price_type\" id=\"price_type\" style=\"border-radius: 0px;\" aria-label=\"Default select example\">\n"
" <option value=\"\" selected>Price Type</option>\n"
" <option value=\"Fixed\">Fixed</option>\n"
" <option value=\"Hourly\">Hourly</option>\n"
" </select>\n"
" </div>\n"
" <div class=\"col-lg-3 col-12\"><button type=\"submit\" class=\"btn btn-dark search\" style=\"border-top-left-radius: 0px; border-bottom-left-radius: 0px\">Search</button></div>\n"
" </div>\n"
" </form>\n\n"
" <div class=\"row\">\n"
" <div class=\"col-12\">\n"
" <div class=\"card mb-4\">\n"
" <div class=\"card-header pb-0\">\n\n"
" <h6>Jobs</h6>\n"
" @if (session('deleted_job'))\n"
" <span style=\"color:red\">{{session('deleted_job')}}</span>\n"
" @endif\n"
" @if (session('min_length_input'))\n"
" <span style=\"color:red\">{{session('min_length_input')}}</span>\n"
" @endif\n"
" </div>\n\n"
" <div class=\"card-body px-0 pt-0 pb-2\">\n"
" <div class=\"table-responsive p-0\">\n"
" @if (count($jobs)>0)\n"
" <table class=\"table align-items-center mb-0\">\n"
" <thead>\n"
" <tr>\n"
" <th class=\"text-uppercase text-secondary text-xxs font-weight-bolder opacity-7\">Title</th>\n"
" <th class=\"text-uppercase text-secondary text-xxs font-weight-bolder opacity-7 ps-2\">Category/Address</th>\n"
" <th class=\"text-uppercase text-secondary text-xxs text-center font-weight-bolder opacity-7 ps-2\">Price type</th>\n"
" <th class=\"text-uppercase text-secondary text-xxs text-center font-weight-bolder opacity-7 ps-2\">Price</th>\n"
" <th class=\"text-center text-uppercase text-secondary text-center text-xxs font-weight-bolder opacity-7\">Start date</th>\n"
" <th class=\"text-center text-uppercase text-secondary text-center text-xxs font-weight-bolder opacity-7\">End date</th>\n"
" <th class=\"text-center text-uppercase text-secondary text-center text-xxs font-weight-bolder opacity-7\">Options</th>\n\n"
" </tr>\n"
" </thead>\n"
" <tbody>\n\n"
" @foreach($jobs as $job)\n\n"
" <tr>\n"
" <td>\n"
" <a href=\"{{route('job.show',$job->slug)}}\">\n"
" <div class=\"d-flex px-2 py-1\">\n"
" <div>\n"
" <img src=\"/images/{{$job->user->photo->name}}\" class=\"avatar avatar-sm me-3\" alt=\"user1\">\n"
" </div>\n"
" <div class=\"d-flex flex-column justify-content-center\">\n"
" <h6 class=\"mb-0 text-sm\">{{$job->title}}</h6>\n"
" <p class=\"text-xs text-secondary mb-0\">{{$job->user->company->name}}</p>\n"
" </div>\n"
" </div>\n"
" </a>\n"
" </td>\n"
" <td>\n"
" <p class=\"text-xs font-weight-bold mb-0\">{{$job->category->name}}</p>\n"
" <p class=\"text-xs text-secondary mb-0\">{{$job->address}}</p>\n"
" </td>\n"
" <td class=\"align-middle text-center text-sm\">\n"
" <p class=\"text-xs font-weight-bold mb-0\">{{$job->price_type}}</p>\n"
" </td>\n"
" <td class=\"align-middle text-center text-sm\">\n"
" <p class=\"text-xs font-weight-bold mb-0\">{{$job->price}}</p>\n"
" </td>\n"
" <td class=\"align-middle text-center text-sm\">\n"
" <p class=\"text-xs font-weight-bold mb-0\">{{$job->startingDate}}</p>\n"
" </td>\n"
" <td class=\"align-middle text-center\">\n"
" <p class=\"text-xs font-weight-bold mb-0\">{{($job->endingDate) ? $job->endingDate : '/' }}</p>\n"
" </td>\n"
" <td class=\"align-middle text-center\">\n"
" <span class=\"text-secondary text-xs font-weight-bold\">\n"
" <form action=\"{{route('job.destroy',$job->slug)}}\" method=\"POST\" style=\"display: inline; \">\n"
" @csrf\n"
" @method('DELETE')\n"
" <button type=\"submit\" name=\"remove_job\" style=\"text-decoration: none; color:red!important; padding: 0; margin:0!important;text-transform: none;\" class=\"btn btn-link\">Delete</button>\n"
" </form>\n"
" </span>\n"
" </td>\n"
" </tr>\n"
" @endforeach\n\n"
" </tbody>\n\n"
" </table>\n"
" @else\n"
" <span style=\"color:red; margin-left: 25px;\">No jobs found.</span>\n"
" @endif\n"
" <div class=\"d-flex justify-content-center mt-3\">\n"
" {{$jobs->links()}}\n\n"
" </div>\n"
" </div>\n\n"
" </div>\n\n"
" </div>\n"
" </div>\n"
" </div>\n\n"
" @endsection\n"
" @section('scripts')\n"
" <script>\n"
" const searchBtn = document.querySelector('.search');\n"
" searchBtn.addEventListener('click', function() {\n\n"
" const searchField = document.querySelector('#q');\n"
" const categoriesBtn = document.getElementById('category');\n"
" const categoryValue = categoriesBtn.options[categoriesBtn.selectedIndex].text;\n\n"
" const jobtypeBtn = document.getElementById('job_type');\n"
" const jobtypeValue = jobtypeBtn.options[jobtypeBtn.selectedIndex].text;\n\n"
" const pricetypeBtn = document.getElementById('price_type');\n"
" const pricetypeValue = pricetypeBtn.options[pricetypeBtn.selectedIndex].text;\n\n"
" if (searchField.value == '') {\n"
" searchField.disabled = true;\n"
" }\n"
" if (categoryValue == 'Categories') {\n"
" categoriesBtn.disabled = true;\n"
" }\n"
" if (jobtypeValue == 'Job Type') {\n"
" jobtypeBtn.disabled = true;\n"
" }\n"
" if (pricetypeValue == 'Price Type') {\n"
" pricetypeBtn.disabled = true;\n"
" }\n\n"
" });\n"
" </script>\n\n"
" @endsection")
subst = ">{{__(\"$1\")}}</"
result = regex.sub(subst, test_str)
if result:
print(result)
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Python, please visit: https://docs.python.org/3/library/re.html