Web Scraping using cheerio and Axios

Not able to access scraping from https://www.ambito.com/contenidos/dolar.html, venta and compra data using axios and cheerio on Node.js, used below code to access these data, here I’m trying to scrape data from css selectors and html tags, I’m able to access title but not venta and compra, meaning of venta and compra is buy and sell respectively.

async function fetchQuotes() {
  const sources = [
    'https://www.ambito.com/contenidos/dolar.html',
    'https://www.dolarhoy.com',
    'https://www.cronista.com/MercadosOnline/moneda.html?id=ARSB',
  ];

  const quotes = [];
  for (const source of sources) {
    try {
      const response = await axios.get(source);
      const $ = cheerio.load(response.data);
      const col1 = $('.variation-max-min');
      col1.each((index, element) => {
        // Extract relevant data
        const title = $(element)
          .find('.variation-max-min__title')
          .text()
          .trim();
        const buyPrice = $(element)
          .find('.variation-max-min__value data-valor data-compra')
          .text();
        const sellPrice = $(element)
          .find('.variation-max-min__value data-valor data-venta')
          .text();
        quotes.push({
          title: title,
          sell_price: sellPrice,
          buy_price: buyPrice,
        });
        // Output the extracted data
        console.log(`Title: ${title}`);
        console.log(`Buy Price: ${buyPrice}`);
        console.log(`Sell Price: ${sellPrice}`);
        console.log('-------------------');
      });
    } catch (error) {
      console.error('Error fetching quote from', source, ':', error.message);
    }
  }
  return quotes;
}

JS Syntax Error after deploying to CloudFlare

I have a static website built using Svelte (4.2.10) + Vite (5.1.1) + TypeScript (5.2.2).

When I run the developmental frontend by running vite locally, it runs fine and renders without any problem. When I build the website using vite build and use miniserve to serve the dist static directory, it also renders completely fine.

However, when I deploy the website on Cloudflare and open the deployed website, the browser complains about a SyntaxError and does not render.

I have created a minimal reproducible example at https://gitlab.com/hykilpikonna/vite-reproducible-bug. The only dependency required to reproduce this behaviour seems to be core-js. The bugged version can be accessed at https://test0213.hydev.org/ – this page should show “1,2,3,4,5” but instead shows a SyntaxError in the console.

Some properties of this bug:

  • It cannot be reproduced when I deploy to Cloudflare pages without a domain (i.e. https://vite-reproducible-bug.pages.dev/ works as intended)
  • It cannot be reproduced when deployed locally using Nginx.
  • It does not immediately show up. It only appears after refreshing the page when the developer console is open. However, after the bug shows up, refreshing the page doesn’t fix it.
  • I have tried different browsers and clean profiles, which all showed this behaviour, so it couldn’t be caused by my browser extensions.

Steps to replicate this bug from scratch:

  1. Create a vite svelte project using npm create vite@latest
  2. Install core-js, import and use it in your code
  3. Deploy it to CloudFlare pages (I used GitHub and GitLab integrations)
  4. Set a CloudFlare domain URL for the CloudFlare pages.

enter image description here

enter image description here

Unable to retrieving chat history using Strophe.js and Ejabberd with XEP-0313: Message Archive Management (MAM)

I’m currently working on a web-based chat application using Strophe.js as the XMPP client library and Ejabberd as the XMPP server. I’m attempting to implement support for retrieving chat history using XEP-0313: Message Archive Management (MAM), but I’m encountering difficulties.

My goal is to fetch the chat history for a particular user and display it in the chat interface. However, my current implementation seems to only return the count of messages, rather than the actual message content.

Here’s a snippet of my code for retrieving the chat history:

const iq = $iq({
  type: 'set',
  id: 'juliet1',
}).c('query', {
  xmlns: 'urn:xmpp:mam:2'
}).c('x', {
  xmlns: 'jabber:x:data',
  type: 'submit'
}).c('field', {
  var: 'FORM_TYPE',
  type: 'hidden'
}).c('value').t('urn:xmpp:mam:2').up().up().c('field', {
  var: 'with'
}).c('value').t(jid).up().tree();

connection.sendIQ(iq, function(response) {
   const message = response.getElementsByTagName('result');
   console.log(response);
   messages.forEach(message => {
      const body = Strophe.getText(message.querySelector("body"));
      const from = message.getAttribute('from');
      displayMessage(from, body);
   });
   return true;
});

The issue I’m facing is that response.getElementsByTagName(‘result’) doesn’t return any messages, when console logging response i am getting only –

<iq xmlns="jabber:client" xml:lang="en" to="dev@localhost/1178459894898988032171235" from="dev@localhost" type="result" id="juliet1">
  <fin xmlns="urn:xmpp:mam:2" complete="true">
    <set xmlns="http://jabber.org/protocol/rsm">
      <count>1</count>
      <first>1707854878326932</first>
      <last>1707854878326932</last>
    </set>
  </fin>
</iq>

I’ve double-checked my XMPP server configuration, and it seems to support MAM properly.

I’m wondering if there’s something wrong with my code or if there’s a better approach to retrieving chat history using Strophe.js and Ejabberd. Any insights or suggestions would be greatly appreciated.

Strophe.js version: 1.6.0

Ejabberd version: 23.10.0

ejabberd.yml

mod_mam:
  ## Mnesia is limited to 2GB, better to use an SQL backend
  ## For small servers SQLite is a good fit and is very easy
  ## to configure. Uncomment this when you have SQL configured:
  ## db_type: sql
  assume_mam_usage: true
  default: always

Thank you in advance for your help!

note: – I have tested the query in Gajim XML console and it returns the messages.

How do I split a string by each character but ignore not when the character is special

I have uniqueId labels that I’m trying to have read out properly by voice over which are a mix of numbers, letters and special characters.

I want to split a string by each character except when it is a special character.

For example

If I have

const string = 'ABC9!3J;R7.T'

Now obviously string.split('') will equal ['A', 'B', 'C', '9', '!', '3', 'J', ';', 'R', '7', '.', 'T'] which is not what I want.

So what regex do I need to use in to get the split function to ignore special characters so I will have this expected.

expected = ['A', 'B', 'C', '9!', '3', 'J;', 'R', '7.', 'T']

Regex is not my forte so any help would be greatly appreciated.

I’ve tried using a few regex’s using Phind and looking for something similar on stack overflow but it seems as if people usually want to do the opposite of what I want.

Express response body [closed]

For whichever reason, there is never a body reponse. It always replies with the standard 200 ok message, but the body remains a mystery.. I also dont see why it would be.

class feedRoute {
   constructor(base) {
                Object.defineProperty(this, 'base', { value: base });

                this.sendBack = [];

                this.router = Router();

                this.router.post('/feed', async (req, res, next) => {
                        await this.loopThrough(req.body);
                        console.log(this.sendBack);
                        res.json(this.sendBack);
                        this.sendBack = [];
                        return undefined;
                });
        }
};

screenshot console

C# WASM Encryption/Decryption using JS Interop error: Unhandled exception rendering component

I’m having some issues when I try to decrypt a string in c# wasm using js interop. I’m new to encryption/decryption so I am unsure of what the error is actually saying. I have stepped through my code and logged the keys, iv and other items and seems they are the proper values.

Here is the code I have.

Blazor page

Encryption.razor

<div class="input-container">
    <label for="plainText">Input string</label>
    <div class="input-wrapper">
        <input id="plainText" type="text" @bind="plainText" title="Input string" />
    </div>
</div>

<div class="button-container">
    <button @onclick="Encrypt" class="button-style button-one">Encrypt</button>
    <button @onclick="Decrypt" class="button-style">Decrypt</button>
</div>

<div class="input-container">
    <label for="encryptedMessage">Encrypted/Decrypted Message</label>
    <div class="input-wrapper">
        <input id="encryptedMessage" type="text" @bind="encryptedMessage" />
    </div>
</div>

@code {
    private string plainText = "";
    private string encryptedMessage = "";
    private string keyBase64 = "";
    private string ivBase64 = "";

    // Method to generate a key and IV
    private async Task GenerateKeyAndIV()
    {
        keyBase64 = await JSRuntime.InvokeAsync<string>("generateKey");
        ivBase64 = await JSRuntime.InvokeAsync<string>("generateIV");
    }

    private async Task Encrypt()
    {
        await GenerateKeyAndIV();
        encryptedMessage = await encryptionService.Encrypt(plainText, keyBase64, ivBase64);
    }

    private async Task Decrypt()
    {
        await GenerateKeyAndIV();
        plainText = await encryptionService.Decrypt(encryptedMessage, keyBase64, ivBase64);
    }

    // Call GenerateKeyAndIV when the component is initialized
    protected override async Task OnInitializedAsync()
    {
        await GenerateKeyAndIV();
    }

EncryptionService.cs

using Microsoft.JSInterop;
using System.Threading.Tasks;

public class EncryptionService
{
    private readonly IJSRuntime _jsRuntime;

    public EncryptionService(IJSRuntime jsRuntime)
    {
        _jsRuntime = jsRuntime;
    }

    public async Task<string> Encrypt(string text, string keyBase64, string iv)
    {
        return await _jsRuntime.InvokeAsync<string>("encryptText", text, keyBase64, iv);
    }

    public async Task<string> Decrypt(string encryptedBase64, string keyBase64, string iv)
    {
        return await _jsRuntime.InvokeAsync<string>("decryptText", encryptedBase64, keyBase64, iv);
    }
}

index.html scripts

<script>
      window.generateKey = async () => {
          const key = await crypto.subtle.generateKey(
              { name: 'AES-GCM', length: 128 },
              true,
              ['encrypt', 'decrypt']
          );
          const keyBytes = await crypto.subtle.exportKey('raw', key);
          return btoa(String.fromCharCode.apply(null, new Uint8Array(keyBytes)));
      };
</script> 

<!-- Function to generate IV -->
<script>
window.generateIV = async () => {
    const iv = crypto.getRandomValues(new Uint8Array(12));
    return btoa(String.fromCharCode.apply(null, iv));
};
</script>

<!-- Function to encrypt text using AES-GCM algorithm -->
<script>
  async function encryptText(text, keyBase64, ivBase64) {
      const iv = new Uint8Array(atob(ivBase64).split('').map(char => char.charCodeAt(0)));
      const keyBytes = new Uint8Array(atob(keyBase64).split('').map(char => char.charCodeAt(0)));
      const encodedText = new TextEncoder().encode(text);
      const encodedKey = await crypto.subtle.importKey("raw", keyBytes, "AES-GCM", false, ["encrypt"]);
      const encryptedBytes = await crypto.subtle.encrypt({ name: "AES-GCM", iv }, encodedKey, encodedText);
      return btoa(String.fromCharCode.apply(null, new Uint8Array(encryptedBytes)));
  }
</script>

<!-- Function to decrypt text using AES-GCM algorithm -->
<script>
  async function decryptText(encryptedBase64, keyBase64, ivBase64) {
      const iv = new Uint8Array(atob(ivBase64).split('').map(char => char.charCodeAt(0)));
      const keyBytes = new Uint8Array(atob(keyBase64).split('').map(char => char.charCodeAt(0)));
      const encryptedBytes = new Uint8Array(atob(encryptedBase64).split('').map(char => char.charCodeAt(0)));
      const importedKey = await crypto.subtle.importKey("raw", keyBytes, "AES-GCM", false, ["decrypt"]);
      const decryptedBytes = await crypto.subtle.decrypt({ name: "AES-GCM", iv }, importedKey, encryptedBytes);
      return new TextDecoder().decode(decryptedBytes);
  }
</script>

I have logged the values and they seem correct. I have tried consulting chatGPT on the error but it doesn’t specificy what exactly the issue is in the decrypt function.

error msg

The link button is not shown as selected (lacking color border)

I have a routing app with three navigation link buttons(home/about/dashboard). I am using Bootstrap 5.
My app.component.html looks like this:

<div style="text-align:center">
  <h1>
    Welcome to {{title}}!!
  </h1>
  <nav>
    <div class="container">
      <div class="row">
        <div class="col-2">
          <a routerLink="home" routerLinkActive="active"><button type="button" class="btn btn-primary">
              Home</button></a>
              
        </div>
        <div class="col-2">
          <a routerLink="about"><button type="button" class="btn btn-primary">
              About</button></a>
        </div>

        <div class="col-1">
          <a routerLink="dashboard"><button type="button" class="btn btn-primary">
              Dashboard</button></a>
        </div>
      </div>
    </div>
  </nav>
  <router-outlet></router-outlet>
</div>

I expected that when I click on one of the link buttons, it will appear with the border color changed indicating that it is selected.
I have prepared stackBlitz of my app, that illustrates the problem. No matter which button you click none of them is shown as selected (with the border color changed).

Get sheet with name that includes the most recent date using apps script

I have multiple sheets all with names “Pipeline History mm-dd-yyyy” with different dates. I want to search the names of the sheets for the most recent date. And then hide that sheet. I have started writing some code, but I don’t even know where to start.

This is what I’ve tried to get started with:

var allSheets = ss.getSheets();
var searchText = "Pipeline History";
var pipelineHistorySheets = allSheets.filter(s => s.getSheetName().includes(searchText));

crashing in a minecraft server [duplicate]

i keep trying to play in a minecraft server with mods, but i crash and it says “Error: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0” i am unsure what to do to fix this problem. i have looked everywhere and have found nothing except for videos telling me to not use the mods, which is not going to be the solution to the problem.

tried restarting the game, restarting my computer, lowering my render distance in game, and updating the game. none of it has worked.

Download image flashes open on load when it should be closed

I have created a button to show am image when clicked at the bottom of my website. I have included the code below. The issue is that the image flashes and is shown open when I load the page. How can I fix that issue?

<style>
/* -------- DOWNLOAD OUR APP -------- */
.byok-container {
    margin-left: 2rem;
    margin-right: 2rem;
    background-color: #22262b;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.byok-popup {
    display: none;
}
.popup-button {
    display: none;
}
.open-text {
    display: none;
}



/* Show popup */
.show-popup {
    display: grid;
}

.show-popup .byok-popup-content {
    transform: scale(1) translateY(0);
}

/* -------------- BREAKPOINTS -------------- */

@media screen and (min-width: 700px) {
    /*.mobile-text {
    display: none;
}*/
.byok-popup-content {
        position: fixed;
        right: 40px;
        bottom: 13px;
        z-index: 30000;
        margin-top: 5px;
        background-color: #CFA240;
        text-align: center;
        padding: 0.3rem;
        border-radius: 20px;
        transition: all 0.3s;
        transform: translateY(10%);
    }
.byok-open {
    background-color: #CFA240;
    position: fixed;
    bottom: 5px;
    right: 10px;
    z-index: 100;
    border-radius: 40px;
}
    
.mobile-button {
    display: none;
}
    .byok-container {
        margin-left: 1rem;
        margin-right: 1rem;
        background-color: transparent;
        height: 0;
        width: 0;
        position: fixed;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    .open-text {display: inline;}
    
    .byok-popup-container {
        overflow: scroll;
        transition: all 0.3s;
        z-index: 1000;
        background-color: transparent;
        width: 100%;
        height: 0%;
        display: block;
    }
    .popup-button {
    display: inline-block;
    background-color: #CFA240;
    color: #fff;
    padding: 1rem 1.25rem;
    margin: 0.5rem;
    transition: 0.3s;
    text-align: left;
    border: none;
}
    .open-text {
    font-family: "Josefin Sans", sans-serif;
    font-size:16px;
    padding: 5px 8px;
    margin: 0;
}
    .byok-popup-close {
    display: inline-flex;
    color: #fff;
    font-size: 2rem;
    position: absolute;
    top: 0.9rem;
    right: 1.5rem;
    margin: 0;
    cursor: pointer;
    z-index: 500;
    line-height: 30px;
}

    .byok-popup-content {
        margin: auto;
        width: 300px;
        border-radius: 1.75rem;
    }
    .popup-img {
        width: 50px;
    }
    .byok-open {
        right: 40px;
    }
    .byok-close {
    font-size: 50px;
    font-weight: 200;
    color: #fff;
}
}
</style>

Here is the button and javascript:


<button class="popup-button byok-open" id="open-popup">
    <p class="open-text">DOWNLOAD OUR APP</p>
</button>

<div class="byok-popup byok-container" id="popup-container"> <!-- Main Container -->

        <div class="byok-popup-container"> <!-- Popup Container -->

        <div class="byok-popup-content"> <!-- Popup Content -->
            <div class="byok-popup-close" title="Close" id="byok-top-close">
                <div class="byok-close">×</div>
            </div>
            <img src="/img.php" alt="app QR code, scan to go to your app store">
            </div>
    </div>
</div>

<script>
const popupContainer = document.getElementById("popup-container");
const byokButton = document.getElementById("open-popup");
const popup = document.querySelector(".byok-popup");

// Open Popup
const showPopup = () => {
  sessionStorage.setItem('BYOK Activity', 'Active');
  popupContainer.classList.add('show-popup');
  byokButton.style.display = 'none';
  popup.style.display = 'grid';
  // Add close buttons
  const closeX = document.getElementById("byok-top-close");
  closeX.addEventListener('click', closePopup);
};

byokButton.addEventListener("click", showPopup);

// Close Popup
const closePopup = () => {
  sessionStorage.setItem('BYOK Activity', 'Inactive');
  popupContainer.classList.remove('show-popup');
    if (window.innerWidth >= 700){
  byokButton.style.display = "block";
    }
  popup.style.display = "none";
}

// Check browser width | Remove popup if mobile
const byokPopupActivity = () => {
  if ((window.innerWidth >= 700) && sessionStorage.getItem('BYOK Activity') === 'Active') {
    showPopup();
    return;
  } 
  closePopup();
  sessionStorage.setItem('BYOK Activity', 'Inactive');
}

byokPopupActivity();
</script>

Ive tried searching online for any similar issues but I couldn’t find any.

Can’t get modal to display type and image of Pokemon

HTML:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>My First JS App</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="css/styles.css">
  </head>
  <body>
    <header class = "page-header">
    <img src = "img/PokemonLogo.svg" alt = "Pokemon Logo" class = "logo">
    </header>
    <h1>POKEDEX (Gotta Catch 'Em All)</h1>
    <ul class = "pokemon-list list-group">

    </ul>
    <div id="modal-container"></div>
    <!-- Button trigger modal -->
    <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
    Launch demo modal
  </button>


<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
      
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      
      <div class= "modal-header">
        <h3 class="modal-title" id="titleModal"> </h3>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <img id="pokemonImage" src=" " alt="pokemon image">
        <div class="container">
          <div class="row">  
          </div>
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-light" data-dismiss="modal" aria-label="Close">Close</button>
      </div>
    </div>
  </div>
</div>
    <img src = "img/voltorb.svg" alt = "picture of the pokemon voltorb" class = "voltorb">
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
    <script src = "js/promise-polyfill.js"></script>
    <script src = "js/fetch-polyfill.js"></script>
    <script src = "js/scripts.js"></script>
  </body>
</html>

JS:

let pokemonRepository = (function () {
  let pokemonList = [];
  let apiUrl = "https://pokeapi.co/api/v2/pokemon/?limit=150";

  function add(pokemon) {
    pokemonList.push(pokemon);
  }

  function getAll() {
    return pokemonList;
  }

  function showDetails(pokemon) {
    loadDetails(pokemon).then(function () {
      showModal(pokemon.name, pokemon.height, pokemon.imageUrl);
    });
  }

  function hideModal() {
    let modalContainer = document.querySelector("#modal-container");
    modalContainer.classList.remove("is-visible");
  }

  window.addEventListener("keydown", (e) => {
    let modalContainer = document.querySelector("#modal-container");
    if (e.key === "Escape" && modalContainer.classList.contains("is-visible")) {
      hideModal();
    }
  });

  function showModal(title, text) {
    const name = document.querySelector("#titleModal");
    const height = document.querySelector(".modal-body");
    name.innerHTML = title;
    height.innerHTML = `Height: ${text}`;
  }

  function addListItem(pokemon) {
    let ulItem = document.querySelector(".pokemon-list");
    let listItem = document.createElement("li");
    let button = document.createElement("button");

    button.setAttribute("data-toggle", "modal");
    button.setAttribute("data-target", "#exampleModal");
    button.innerText = pokemon.name;

    button.classList.add("btn-primary");
    listItem.classList.add("list-group-item");
    listItem.appendChild(button);
    ulItem.appendChild(listItem);

    button.addEventListener("click", function () {
      showDetails(pokemon);
    });
  }

  function loadList() {
    return fetch(apiUrl)
      .then(function (response) {
        return response.json();
      })
      .then(function (json) {
        json.results.forEach(function (item) {
          let pokemon = {
            name: item.name,
            detailsUrl: item.url,
            imageUrl: "",
          };

          add(pokemon);
        });
      })
      .catch(function (e) {
        console.error(e);
      });
  }

  function loadDetails(item) {
    let url = item.detailsUrl;

    return fetch(url)
      .then(function (response) {
        return response.json();
      })
      .then(function (details) {
        // console.log(details);
        // Now we add the details to the item
        item.imageUrl = details.sprites.front_default;
        item.height = details.height;
        item.types = details.types;
      })
      .catch(function (e) {
        console.error(e);
      });
  }

  return {
    add,
    getAll,
    addListItem,
    loadList,
    showDetails,
  };
})();

pokemonRepository.loadList().then(function () {
  // Now the data is loaded!
  pokemonRepository.getAll().forEach(function (pokemon) {
    pokemonRepository.addListItem(pokemon);
  });
});

After some editing, the modal is displaying the Pokemon name and height but not the image from the API. I thought the issue was in the showModal function but when I tried to declare the “image” variable, it has already been declared further down in my code. I am not sure what I am doing wrong and I am feeling very stuck. Any help would be GREATLY appreciated.

Code tampering and change JavaScript code in real time from the console

I’m developing a university project on code tampering. To create my own examples I created a simple HTML page that displays products and adds them to the cart with their price. Once I press the “go to cart” button I calculate the total. Now I need to be able to modify the JavaScript code as if I were an attacker. I tried changing the code from the Chrome developer tools and then went to the source, but once I made a change to the method that loads the price, this change is not reflected on the site, but continues to run the code I have on visual study code. I have already tried from visual studio code and with the same line of code I get the desired result, so there are no syntax errors. Does anyone know how to modify the code from the console or anywhere else to simulate a real-time attack?

I have already tested from the source section of the Chrome developer tools and made sure the code works from visual studio code to eliminate possible syntax errors

How to convert valid regexp to html pattern? Invalid character in character class [duplicate]

I would like to convert valid regexp to html pattern.

Most likely due to new v flag following regexp is no longer valid: ^[a-zA-Z0-9а-яА-ЯёЁ]+([ -][a-zA-Z0-9а-яА-ЯёЁ]+)*$ pattern and gives an error:

Pattern attribute value [a-zA-Z0-9а-яА-ЯёЁ]+([ -][a-zA-Z0-9а-яА-ЯёЁ]+)* is not a valid regular expression: Uncaught SyntaxError: Invalid regular expression: /[a-zA-Z0-9а-яА-ЯёЁ]+([ -][a-zA-Z0-9а-яА-ЯёЁ]+)*/v: Invalid character in character class

Is there a way to convert a valid regexp to pattern, something like /^[a-zA-Z0-9а-яА-ЯёЁ]+([ -][a-zA-Z0-9а-яА-ЯёЁ]+)*$/.source?

If not, what do I need to change exactly?

How to create a mat-table with nested properties as rows

I have data like this:

const parents = [
    {
        name: "Bob",
        children: [
            {
                name: "Mike"
            },
            {
                name: "Sarah"
            }
        ]
    },
    {
        name: "Jim",
        children: [
            {
                name: "Eve"
            },
            {
                name: "Kenny"
            },
            {
                name: "Brook"
            }
        ]
    }
]

I’m trying to create a table that displays the nested children as rows, and would like to use mat-table to match the styling of the rest of my app. I also want columns to include both child and parent names. Currently, I have:

<mat-table
  [dataSource]="parents"
>
  <ng-container matColumnDef="parentName">
    <mat-header-cell *matHeaderCellDef>Child Name</mat-header-cell>
  </ng-container>

  <ng-container matColumnDef="childName">
    <mat-header-cell *matHeaderCellDef>Parent Name</mat-header-cell>
  </ng-container>

  <ng-container matColumnDef="parents">
    <td mat-cell *matCellDef="let parent" [attr.colspan]="displayedColumns.length">
      <tr *ngFor="let child of parent.children">
        {{ child.name }}
      </tr>
    </td>
  </ng-container>

  <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
  <tr mat-row *matRowDef="let row; columns: ['parents']"></tr>
</mat-table>

But I’m getting stuck on how to get the cells to line up with the headers.

Show and Hide JavaScript / jQuery [closed]

I need to show and hide the Detail Section of my resume timeline, but I can’t figure out why it doen’t do anything

what I wanna do is when clicking on the div class="content" it should show the element span class= "Details_right" but only the one which is the frist one underneath the clicked Div.

I am kinda confused about the whole thing as it doesn’t seem to do anything.

.Details_right {
  visibility: hidden;
  position: absolute;
  z-index: 999;
  width: 90vw;
  margin-left: -190px;
  background-color: var(--accent1-color);
  border: solid var(--background-color2) 2px;
  border-radius: 1rem;
}
<div class="container right">
  <div class="content">
    <h2>2022</h2>
    <p>Title</p>
  </div>
  <span class="Details_right">orem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo     ue eu, pretium quis</span>
</div>