Skip to content

Commit

Permalink
update find-links function
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushgaud committed Sep 4, 2024
1 parent aa69cd3 commit ab3d2ec
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions src/wrike_ist/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,26 @@
(defn find-links
[text]
(let [wrike-pattern #"https://www\.wrike\.com/open\.htm\?id=\d+"
azure-pattern #"https://dev\.azure\.com/[^/]+/[^/]+/_workitems/edit/\d+"
combined-pattern (re-pattern (str wrike-pattern "|" azure-pattern))]
(let [matches (re-seq combined-pattern text)]
azure-pattern #"https://dev\.azure\.com/[^/]+/[^/]+/_workitems/edit/\d+"]
(let [wrike-matches (re-seq wrike-pattern text)
azure-matches (re-seq azure-pattern text)]
(do
(js/console.log "Combined Pattern:" combined-pattern)
;; Print debug information
(js/console.log "Wrike Pattern:" wrike-pattern)
(js/console.log "Azure Pattern:" azure-pattern)
(js/console.log "Text to Search:" text)
(js/console.log "Matches Found:" matches)
(if (seq matches)
(distinct matches)
(js/console.log "No matching links found"))))))
(js/console.log "Wrike Matches Found:" wrike-matches)
(js/console.log "Azure Matches Found:" azure-matches)

;; Combine results
(cond
(seq wrike-matches) wrike-matches
(seq azure-matches) azure-matches
:else (js/console.log "No matching links found"))))))

;; Example usage
(find-links "Here are some links: https://www.wrike.com/open.htm?id=123456 and https://dev.azure.com/organization/project/_workitems/edit/98765")


(defn extract-details
[pr-obj]
Expand Down

0 comments on commit ab3d2ec

Please sign in to comment.