title: How to retrieve all items from a DynamoDB table with Node.js?
body: <p>I have the following node js code that should list all items from a DynamoDB table,</p>
  <pre><code>import * as dynamoDbLib from &quot;../../libs/dynamodb-lib&quot;;
  import { success, failure } from &quot;../../libs/response-lib&quot;;
  
  export async function main(event, context) {
    const params = {
      TableName: &quot;brands&quot;,
  
      KeyConditionExpression: &quot;brandId = :brandId&quot;,
      ExpressionAttributeValues: {
        &quot;:brandId&quot;: ''
      }
    };
  
    try {
      const result = await dynamoDbLib.call(&quot;query&quot;, params);
      return success(result.Items);
    } catch (e) {
       console.log(e);
       return failure({ status: false });
    }
  }
  </code></pre>
  <p>The id is in uuid format which when inserted from my node js was imported by using:</p>
  <pre><code>import uuid from &quot;uuid&quot;;
  </code></pre>
  <p>then inserted to the table like:</p>
  <pre><code>brandId: uuid.v1()
  </code></pre>
  <p>Now when I query the items in the table I can only get only one record if and only if I hard coded the uuid of a record in the expression attribute value (either the KeyConditions or KeyConditionExpression parameter must be specified). So I thought about adding a regular expression to match all the uuids, my regular expression was copied from some solutions on the web but it didn't work, it was like the following:</p>
  <pre><code>[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}
  </code></pre>
  <p>and</p>
  <pre><code>\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b
  </code></pre>
  <p>and I have tried other examples but non of them worked, is it right to add a regular expression to get all the items, and if so what is the right regex for it?</p>