File Mover Blog

  • 12 Nov

    Regular expressions reference guide

    Regular expressions reference guide

    ANCHORS

    ^         Match the start of a string
    $         Match the end of a string
    \b        Match a word boundary
    \B        Match a non-word boundary

    ANCHORS Examples

    ^Hello    Matches "Hello world" but not "Say Hello"
    world$    Matches "Hello world" but not "world peace"
    \bcat\b   Matches "cat" in "the cat sat" but not in "category"
    \Bcat     Matches "cat" in "category" but not in "the cat"
    \bcat     Matches "cat" at word start: "cat" and "category"
    cat\b     Matches "cat" at word end: "cat" and "tomcat"

    CHARACTER SETS

    [xyz]     Match any of x, y or z
    [^xyz]    Match anything except x, y or z
    [0-9]     Match any digit
    [a-z]     Match any lowercase letter

    CHARACTER SETS Examples

    [aeiou]   Matches any vowel
    [^aeiou]  Matches any consonant (non-vowel)
    [0-9]     Matches "5" in "Hello5"
    [a-zA-Z]  Matches any letter (upper or lower)
    [a-z0-9]  Matches any lowercase letter or digit
    gr[ae]y   Matches both "gray" and "grey"
    [^0-9]    Matches any non-digit character

    ESCAPE CHARACTERS

    \.        Matches a literal period/dot character
    \d        Matches any digit (0-9)
    \s        Matches any whitespace (space, tab, newline)
    \w        Matches any word character (a-z, A-Z, 0-9, _)
    \D        Matches any non-digit
    \S        Matches any non-whitespace
    \W        Matches any non-word character

    ESCAPE CHARACTERS Examples

    192\.168\.1\.1   Matches IP address (dots are literal)
    \d{3}            Matches "123" in "Room 123"
    Hello\sWorld     Matches "Hello World" or "Hello World"
    \w+              Matches "hello", "test123", "my_var"
    \d+\.\d+         Matches decimal numbers like "3.14" or "99.99"
    \w+@\w+\.\w+     Matches simple email pattern

    FLAGS / MODIFIERS

    i         Case-insensitive matching
    g         Global match (find all matches)
    m         Multiline mode (^ and $ match line breaks)
    s         Dotall mode (. matches newline)

    FLAGS / MODIFIERS Examples

    Case-insensitive (i):
    /hello/ Matches only “hello”
    /hello/i Matches “hello”, “Hello”, “HELLO”, “HeLLo”

    Global (g):
    /cat/ Matches first “cat” in “cat and cat”
    /cat/g Matches both “cat” instances

    Multiline (m):
    Text: “Line 1\nLine 2\nLine 3”
    /^Line/ Matches only first “Line”
    /^Line/m Matches all three “Line” at start of each line
    /\d$/m Matches digit at end of each line

    Dotall (s):
    Text: “Hello\nWorld”
    /Hello.World/ No match (. doesn’t match \n)
    /Hello.World/s Matches (. now matches \n)

    Combined flags:
    /test/gi Case-insensitive AND global
    /^start/mi Multiline AND case-insensitive

    GREEDY vs LAZY

    *         Greedy: match as much as possible
    *?        Lazy: match as little as possible
    +         Greedy
    +?        Lazy
    ?         Greedy
    ??        Lazy
    {n,m}     Greedy
    {n,m}?    Lazy

    GROUPS

    (xyz)     Match 'xyz' as group
    (x|y)     Match 'x' or 'y'
    (?=xyz)   Match succeeds only if followed by xyz
    (?!xyz)   Match succeeds only if not followed by xyz

    GROUPS Examples

    (cat|dog)        Matches "cat" or "dog"
    (\d{3})-(\d{4})  Matches "555-1234" (captures area code and number separately)
    (https?://)?     Matches optional "http://" or "https://"
    test(?=ing)      Matches "test" in "testing" but not in "tester"
    test(?!ing)      Matches "test" in "tester" but not in "testing"
    \d+(?=px)        Matches "10" and "20" in "10px 15em 20px"
    \$\d+(?!\.)      Matches "$50" but not "$50.99" (whole dollars only)
    

    GROUPS References (BACKREFENCES)

    \1        Reference to first captured group
    \2        Reference to second captured group

    SPECIAL CHARACTERS

    \t        Tab character
    \n        Newline
    \r        Carriage return
    \\        Literal backslash
    \*        Literal asterisk
    \+        Literal plus
    \?        Literal question mark

    SPECIAL CHARACTERS Examples

    \t           Matches tab in "Hello\tWorld"
    \n           Matches newline in multi-line text
    Price: \$50  Matches "Price: $50" (literal dollar sign)
    C:\\Users    Matches "C:\Users" (literal backslash)

    QUANTIFIERS

    ?         Match 0 or 1 time (optional)
    *         Match 0 or more times
    +         Match 1 or more times (at least once)
    {n}       Match exactly n times
    {n,}      Match n or more times
    {n,m}     Match between n and m times

    QUANTIFIERS Examples

    a?        Matches "" or "a"
    a*        Matches "", "a", "aa", "aaa", etc.
    a+        Matches "a", "aa", "aaa", etc. (but not empty)
    a{3}      Matches exactly "aaa"
    a{2,}     Matches "aa", "aaa", "aaaa", etc.
    a{2,4}    Matches "aa", "aaa", or "aaaa"
    

    If you need any help about this ‘Regular expressions reference guide’, please let us know.

    Best Regards,

    Limagito Team

    #regex #managedfiletransfer #filetransfer #filemanagement

    By Limagito-Team Rename ,
  • 01 Nov

    How to create a certificate using powershell

    How to create a certificate using powershell

    In a previous blog article we used a self signed certificate to authenticate against Azure. We used PowerShell to achieve this.

    We used the following PowerShell script:

    • We used “C:\ProgramData\LimagitoX\Certificates\Sharepoint” as output path for the certificate files
    • We used  Test123!  as password
    • Our certificate is valid for two years > -NotAfter (Get-Date).AddYears(2)

     

    # This PowerShell script will create the certificate files under the following directory
    $certPath = "C:\ProgramData\LimagitoX\Certificates\Sharepoint"
    New-Item -ItemType Directory -Path $certPath -Force | Out-Null
    
    $cert = New-SelfSignedCertificate -Subject "CN=FileMoverCert" `
        -CertStoreLocation "Cert:\CurrentUser\My" `
        -KeyExportPolicy Exportable `
        -KeySpec Signature `
        -KeyLength 2048 `
        -KeyAlgorithm RSA `
        -HashAlgorithm SHA256 `
        -NotAfter (Get-Date).AddYears(2)
    
    $password = ConvertTo-SecureString -String "Test123!" -Force -AsPlainText
    Export-PfxCertificate -Cert $cert -FilePath "$certPath\FileMover.pfx" -Password $password
    Export-Certificate -Cert $cert -FilePath "$certPath\FileMover.cer"
    
    Write-Host "Certificate created!" -ForegroundColor Green
    Write-Host "Thumbprint: $($cert.Thumbprint)"
    Write-Host "Upload $certPath\FileMover.cer to Azure Portal"
    

    Open PowerShell as Administrator (Run as Admin ..) and paste the script + <Enter>

    limagito file mover create a certificate

    If you need any help about this ‘create a certificate’ article, please let us know.

    Best Regards,

    Limagito Team

    #certificate #managedfiletransfer #filetransfer #filemanagement

  • 30 Oct

    Sharepoint Authentication using Client ID and Certificate

    ..using Client ID and Certificate

    Although we recommend our OAuth 2.0 authorization code flow , we received a request from a customer who wanted to use the Client ID and Client Secret to authenticate. We had this already available as Auth Type ‘Online Authentication using Client Credentials without User Dialog’. It appeared this option was outdated, so we updated that part of our code. Later we found out that for newly created SharePoint Sites, this ‘Client ID and Client Secret’ authentication no longer worked. It was replaced by ‘Client ID and Certificate’ authentication, so we added this option as well.

    Limagito FileMover Setup

    • Setup
      • Set Site Url and Directory
      • Select ‘Online Authentication using Client Credentials without User Dialog’ as Auth Type

    limagito filemover sharepoint setup

    • OAuth2
      • Set Token Endpoint URL to: https://login.microsoftonline.com/%realm/oauth2/v2.0/token
      • Set Scope to: https://yourSite.sharepoint.com/.default
      • Set Realm (= Directory Tenant ID)

    limagito file mover sharepoint Client ID and Certificate

    limagito filemover sharepoint Client ID and Certificate

    Azure Setup

    • Register an application

    limagito filemover azure register an application

    limagito file mover azure app registrations

    • Overview
      • Application (client) ID is being used in the filemover OAuth2 setup
      • Directory (tenant) ID is being used in the filemover OAuth2 setup

    limagito filemover azure app registrations

    • Authentication Setup

    limagito filemover authentication setup

    • Certificates & secrets Setup
      • Upload the public part of your certificate here (.cer)

    limagito file mover certificate setup

    • API permissions Setup
      • Add permission: SharePoint > Sites.ReadWrite.All

    limagito filemover api permissions setup

    • Owners Setup

    limagito filemover azure owners setup

    • Optional, you could use the ‘Integration assistant’ to do a check. Select ‘Daemon’ as Application type and set ‘Calls APIs’ to Yes

    limagito filemover azure integration assistant

    • Access control check
      • Open your ‘SharePoin admin center’
        • Access control > Apps that don’t use modern authentication
          • Allow access

    limagito filemover sharepoint admin center

     

    If you need any help about this ‘Client ID and Certificate’ option, please let us know.

    Best Regards,

    Limagito Team

    #sharepoint #managedfiletransfer #filetransfer #filemanagement

    By Limagito-Team SharePoint ,
1 2 3 4 163
SEARCH